When i try to generate a war file, it is showing some error like
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
When i do echo %path%
it shows
C:\Windows\System32;D:\name\name1\Softwares\Maven\apache-maven-3.0.4\b
in;C:\Program Files\Notepad++\;%JDK_HOME%
When i do echo %JDK_HOME%
D:\name\name\core java\software\Java\Java_1.6.0_04_win\jdk1.6.0_04\bin
I don't know why maven is refering to jre, when my environmental variable is jdk. I also changes installed JRE to jdk1.6.
Had the same problem, but in my case, the directory eclipse pointed the JRE was the JDK. So, i searched for that tools.jar and was there.
I did
And then compiled fine
The JDK_HOME variable should always point to the base dir of the jdk, not the bin dir:
That defined, fix your path to be
If you we are doing all above steps that may be confused and our problem is just missing tools.jre so just add tools.jre by the following steps and problem is solved.
Step 1 : In eclipse go to Windows -> preferences
Step 2 : Java -> Installed JREs (Double click on it)
Step 3 : Click Edit button -> Click Add External JARs
Step 4 : Now select tools.jar path
now apply changes and it works fine.
Here is screenshoot
Go to Window -> Preferences... -> Java -> Installed JREs
Edit JRE Home = JAVA_HOME or JAVA_HOME\jre
For example if you use jdk1.6.0_04 which is installed in C:\Program Files, do the following change:
C:\Program Files\Java\jdk1.6.0_04\jre or C:\Program Files\Java\jdk1.6.0_04 instead of the default one which is at C:\Program Files\Java\jre7
I had the same Error, because of JUNIT version, I had 3 3.8.1 and I have changed to 4.8.1.
so the solution is
you have to go to POM, and make sure that you dependency looks like this
For Intellij Idea set everything appropriately (similarly to this):
and dont forget to restart Idea. This program picks up variables at start so any changes to environtment variables while the program is running will not have any effect.