Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA_HOME should point to a JDK not a JRE

I am trying to set up maven for my project and I am getting this error

"JAVA_HOME should point to a JDK not a JRE"

I know there are already similar question but it did not work. How can I point JAVA_HOME to JDK in windows. I am using IntelliJ IDEA

like image 995
Abdurakhmon Avatar asked Apr 19 '17 12:04

Abdurakhmon


People also ask

Should JAVA_HOME point to JDK or JRE?

If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment). The JDK contains everything the JRE has and more.

Which directory should JAVA_HOME point to?

To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.

Why is my Java JRE not JDK?

JDK is the development kit for Java and JRE is the runtime environment. The JDK itself contains the JRE. To run a Java application you need JRE. However, some program needs compiler at runtime so in that case, you need JDK.

Does JAVA_HOME need to point to bin?

No. Traditionally, JAVA_HOME is set to the JRE or SDK main directory. The bin/ subdirectory might be in your PATH, though.


2 Answers

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

enter image description here

like image 74
sovas Avatar answered Oct 31 '22 16:10

sovas


I am going through the same process on Mac OSX. I installed the latest JDK, then installed Maven. Someone suggested I set the JAVA_HOME variable so I pointed it to the JDK installation folder. When running Maven mvn compile exec:java I received the same error NB: JAVA_HOME should point to a JDK not a JRE.

All I did was unset the JAVA_HOME variable and it worked.

like image 22
Dan Mergens Avatar answered Oct 31 '22 18:10

Dan Mergens