• Register
1 vote
680 views

Problem:

I just completed all the set up for a Java development environment. Downloaded JDK and now trying to set up maven for my project and I am getting this error : nb: java_home should point to a jdk not a jre

I couldn’t figure out the solution anywhere online. I am running a windows 10 based OS.

Any solution from you is much appriciated. Thanks.

12 7 7
15,250 points

Please log in or register to answer this question.

2 Answers

1 vote

Solution:

The problem occurred due to the invalid path settings of your JDK. Please follow me to correct the settings.

Control Panel > System and Security > System > Advanced system settings > Advanced > Environment Variables > New System Variable

This should work fine. Thanks

13 9 6
94,240 points
Solved!
Big Thanks
0 votes

A maven is a powerful tool for building this error. I will explain why this error happens and how to solve this error:

The java Home problem?

After installing Maven, the user has to set the Java_Home environment variable. So the tools know where to find the JDK commands to execute. Maven runs the appropriate java commands against the project source code.

Example:

The most common scenario is to compile the code by using the java command. If the java_home is not pointing to a valid JDK installation, then mevan will throw an error at every execution.

“JAVA_HOME should not point to a JDK nor JRE”

Solution:

Make sure you don’t have a JRE path if you have the delete it.

  • Add the JAVA_HOME to system variable, Variable value is C:\Program Files\Java\jdk-10.0.2 (location of JDK without bin).
  • Add M2 in the system variable. Variable Value:  C:\dev\maven\apache-maven-3.5.4 ( location of maven with bin).
  • Add M2_HOME in the system variables. Variable value: C:\dev\maven\apache-maven-3.5.4 (location of maven with bin).
  • Add %JAVA_HOME% and %M2% in Path System Variable or C:\Program Files\Java\jdk-10.0.2 and C:\dev\maven\apache-maven-3.5.4\bin.

Note:

 For Windows 10, just add the location. For other versions, at the end of Variable Value Field add a semicolon and then location like;%JAVA_HOME%;%M2%

11 5 2
3,890 points

Related questions

0 votes
2 answers 632 views
632 views
Intellij IDEA on windows 10 is producing the error while trying to run my maven project. the following output show while running: C:\> mvn -version The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE What would be the proper solution of this problem?
asked Mar 10, 2020 LizzyM 6.1k points
1 vote
1 answer 119 views
119 views
Problem: When i am trying run an application in JBOSS 4.0 via eclipse 3.3 i am getting the below exception: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK I had to set the environment ... coming and how to fix. I am able to execute the same application with tomcat 5.0. Can anybody help me to solve out this problem.
asked Apr 8, 2020 LizzyM 6.1k points
0 votes
1 answer 37 views
37 views
Problem: I am trying to set up a maven for my project and I am getting this error
asked Feb 17 TeamScript 13.5k points
1 vote
1 answer 2.4K views
2.4K views
Problem: I am a windows seven user and recently I’ve installed JDK to learn java but I am getting an error. The message is something like: Missing server JVM at `C:\Program Files\Java\jre7\bin\server\jvm­­.dll' please install or use the JRE or JDK that contains these missing components. Your kind solution is much appreciated.
asked Mar 22, 2020 Gavin 15.3k points
1 vote
1 answer 2 views
2 views
Problem: How can I deal with this problem : perhaps you are running on a jre rather than a jdk
asked Apr 4 MUHAMMAD MUNEEB 83k points
1 vote
1 answer 3 views
3 views
Problem: I need a help , How I can fix this : perhaps you are running on a jre rather than a jdk maven
asked Apr 4 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 40 views
40 views
I am new to this. I just want to know how to do that? I have a Java project I am working on and I get this error.
asked Dec 3, 2020 TeamScript 13.5k points
0 votes
1 answer 5 views
5 views
Problem: I will request someone to answer my question Please, I have searched on the web but I got no useful information for this, now I am in difficulty continuing my learning
asked Mar 23 rubelkhan 20.4k points
0 votes
1 answer 7 views
7 views
Problem: I will request someone to answer my question Please, I have searched on the web but I got no useful information for this, now I am in difficulty continuing my learning
asked Mar 21 shamimkhan 15.1k points
0 votes
1 answer 3 views
3 views
Problem: I cannot run my Ant build.xml since I updated to java 1.7.0_52 (or there about). but with this latest jave jdk update somethings different (?). Perhaps JAVA_HOME does not point to the JDK. Any suggestions?
asked Apr 2 ummesalma 25.2k points