Error Maven Unable to locate the Javac Compiler in

0 votes

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\niroj\Softwares\Maven\apache-maven-3.0.4\b
in;C:\Program Files\Notepad++\;%JDK_HOME%

When i do echo %JDK_HOME%

D:\name\niroj\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.

Jun 3, 2020 in Java by kartik
• 37,520 points
3,895 views

1 answer to this question.

0 votes

Hello @kartik,

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

Hope it helps!!

answered Jun 3, 2020 by Niroj
• 82,840 points

Related Questions In Java

+9 votes
16 answers

Unable to resolve this error: "javac is not recognized as an internal or external command"

Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and ...READ MORE

answered May 23, 2018 in Java by Rishabh
• 3,620 points
463,859 views
0 votes
2 answers

How can we add the local JAR files to the Maven Project in Java?

Firstly I would like to give credit ...READ MORE

answered Nov 5, 2018 in Java by Sushmita
• 6,920 points
11,793 views
+1 vote
1 answer

How to tell the Maven to use the latest version of dependency in Java?

If you always want to use the ...READ MORE

answered Jun 26, 2018 in Java by Sushmita
• 6,920 points
15,377 views
0 votes
1 answer

Error:java.lang.OutOfMemoryError: Java heap space in Maven

Hello @kartik, Here is the whole config that ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
13,052 views
0 votes
1 answer

How do I configure Maven for offline development?

Hello @kartik, You have two options for this: 1.) ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
800 views
0 votes
1 answer

How to install Maven artifact with sources from command line?

Hello @kartik, To download sources for your dependencies: mvn ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
2,965 views
0 votes
1 answer

Error: Unable to run mksdcard SDK tool in java?

Hello, If you use  Ubuntu, you can try: sudo apt-get ...READ MORE

answered Apr 9, 2020 in Java by Niroj
• 82,840 points
818 views
0 votes
1 answer

How to open warning/information/error dialog in swing?

Hello, You can try out : import javax.swing.JFrame; import javax.swing.JOptionPane; public ...READ MORE

answered Apr 21, 2020 in Java by Niroj
• 82,840 points
1,429 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP