• Register
1 vote
337 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

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 1
3,890 points

Related questions

1 vote
1 answer 33 views
33 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 LizzyM 6.1k points
0 votes
2 answers 340 views
340 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 LizzyM 6.1k points
1 vote
1 answer 1.3K views
1.3K 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 Gavin 15.3k points
0 votes
1 answer 25 views
25 views
Problem: I am very new to programming. I want to know does Gradle require JDK to compile the Java source files? or is it done by using its own internal compiler?
asked Aug 20 Raphael Pacheco 4.9k points
0 votes
2 answers 76 views
76 views
Problem : I want to compile a project in Eclipse using the m2eclipse. I set my JDK path in Eclipse as below: Windows-->preferences-->installed jres--> jdk1.7.xx path But this is showing me below error [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ ... BUILD FAILURE [INFO] ------------------------------------------------------------------------
asked Feb 4 jwilliam 3.9k points