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

1 vote
1 answer 65 views
65 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
2 answers 482 views
482 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
0 votes
1 answer 13 views
13 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 9.3k points
1 vote
1 answer 1.9K views
1.9K 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
0 votes
1 answer 18 views
18 views
Any suggestions?
asked Dec 28, 2020 TeamScript 9.3k points
0 votes
1 answer 11 views
11 views
Have gotten eclipse to open and work on projects before and won't open.
asked Dec 28, 2020 TeamScript 9.3k points
0 votes
1 answer 52 views
52 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, 2020 Raphael Pacheco 4.9k points
0 votes
2 answers 89 views
89 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, 2020 jwilliam 3.9k points
0 votes
1 answer 2.3K views
2.3K views
Problem : How can i fix the following error build completed with a result of 'failed' unityengine.guiutility:processevent(int32, intptr)
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 682 views
682 views
Problem : I am following the Building Unity game for the Android device for a testing purpose I have followed all the instruction but I am facing below error in the end. My Error: UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors. ... 0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 UnityEditor.HostView:OnGUI() How to fix above error?
asked Jan 21, 2020 jwilliam 3.9k points