Unable to uncover a javac compiler; com.sun.tools.javac.Main is not on the classpath. Possibly JAVA_HOME go not suggest to the JDK

I have actually gone through plenty of SO questions and also found solution is JAVA_HOME have to be allude to JDK, not JRE.

You are watching: Com sun tools javac main is not on the classpath

Then I have actually tried to print JAVA_HOME in command prompt,

*

I had collection this JAVA_HOME from mine computer->properties->env variables -> mechanism vars together below,

*

I had likewise added new variable in eclipse using choices as,

*

And lastly I to be still getting the very same error. Whats wrong with JAVA_HOME ?

Update :

In eclipse-preferences-installed jres over there is just one entrance is present and which is jdk and selected,

*

And under project properties java build path-libraries over there is JRE device Liberary is used.

*

Update 1 :

C:Program FilesJavajdk1.8.0_31 have folder called jre. Is that jre folder resulting in this concern ? have the right to I remove this folder ? Is there is any means to include only jdk liberary in project ?


java eclipse classpath
re-superstructure
improve this concern
monitor
edited Apr 16 "15 in ~ 13:27
Nishant Nawarkhede
asked Apr 16 "15 at 8:06
*

Nishant NawarkhedeNishant Nawarkhede
7,31299 yellow badges5353 silver- badges7373 bronze title
1
include a comment |

2 answers 2


energetic earliest Votes
12
Eclipse is an IDE and also as such, it has (at least) two Java versions: The one which it uses itself to operation (JAVA_HOME) and a JVM i beg your pardon it offers to run your application. The two don"t must be the same.

So to resolve your problem, you should look into Eclipse"s preferences, specifically set up JREs which provides you a list of Java VMs i m sorry Eclipse will usage to run Java password from projects. Mine guess is that there will be number of entries there and the default will be a JRE instead of a JDK.

Make certain you have a JDK in the list and also then walk to your project. In the project, you can choose which Java VM to usage under Java build Path -> Libraries.

Look carefully at the critical screenshot: You"ve configured Eclipse to use C:Program FilesJavajdk1.8.0_31jre which method you"ve pointed it in ~ the JRE within of the JDK. Use C:Program FilesJavajdk1.8.0_31 rather (without the jre at the end).

See more: Tips On Playing China: Civ 6 China Strategy, Kublai Khan China Civ 6 Guide

If you delete the jre folder, Java will avoid working. Any kind of JDK likewise contains a JRE. The JRE includes rt.jar through String.class and also the like. The Java compiler is in tools.jar i m sorry is in the JDK.

If recreating the JRE entry in Eclipse doesn"t help, you"ll have actually to include it manually come the classpath.

You deserve to use a variable ("Add Variable...") come make certain Eclipse to update the path when you switch to a new/different JRE. Shot JAVA_HOME v the expansion lib/tools.jar