Maven cannot find JDK

When I run the “mvn clean install” command to build the OpenMRS Core, I get a compilation error saying that I need to use a JDK rather than a JRE. However, I do have the most up-to-date JDK as well as having my environment variables set up and directed towards the right directories. Any help would be appreciated. I have provided a screenshot of the error message, and my environment variables are as follows:

JAVA_HOME: C:\Program Files\Java\jdk-13.0.2

MAVEN_HOME: C:\Users\Zach\Desktop\College Files\CSCI462\OpenMRS\apache-maven-3.6.3

Hii @drazov, Can you post the output of following two commands?

  • java -version
  • mvn -v

It should look similar to this:

Seems that Maven is using the JRE at runtime as opposed to JDK.

this means that in your environment variables,the path you set is pointing to the JRE instead of JDK,try changing the environment variable so that you point at the jdk.

I have everything set to the JDK including the Path and JAVA_HOME variables but it is still using the JRE at runtime. Should my JAVA_HOME and MAVEN_HOME be in my system variables as opposed to user?

I am also getting the same error . Did you find any solution for it ?

@dkayiwa can you help out with this please.

What exact error are you getting?

@dkayiwa sir i can’t use the command mvn clean package on openMRS core repo that i cloned.
maven version - 3.6.3
java version - 1.8.0_201

Do you mind taking a second look at my question? :slight_smile:

@dkayiwa sir i am getting compilation error.

Adding screenshots of the terminal sir above.

What does this command return? mvn -v

Could you tell us your mvn-v as @dkayiwa stated, did you try to clean or change your m2e. folder?

sir please have a look @dkayiwa @sharif

Sir actually i am new to maven. Can you please elaborate what do you mean by m2e. folder.
Thank you

Sorry for that it seems you are using jdk 11, currently jdk 11 is not yet supported can you try specifying jdk 8. its what currently we use, we havenot shifted or upgraded to jdk 11. so try specifying jdk 8

ok sir thank you so much for such a quick response. will try that immediately

However m2e is a folder containing automatically generated resources, that need to be deployed on the application server. These generated resources are : pom. properties and MANIFEST.m2e works hand in hand with maven and eclipse. you can as well check that folder from C:\Users\SHARIF.m2\repository. just check it from that directory

@sharif @dkayiwa @herbert24 @prathamesh009

Thank you for the help, everything seems to be working for me now. Just waiting on the tests to finish running.

1 Like