This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Cannot Find javac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Cannot Find javac" Watch "Cannot Find javac" New topic
Author

Cannot Find javac

Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
I have jdk1.6.0_23 installed in C:\Program Files\java\

and I have JAVA_HOME pointing to my jdk1.6.0_23.

%JAVA_HOME%\bin\ is in my path.

however, I got
Unable to locate the Javac Compiler in: C:\Program Files\Java\jre6\..\lib\tools.jar


Please advise what I should do. Thank you.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

For some reason your Java installation is looking in the wrong place for the Java compiler (you see it has "jre6" in the path, instead of the directory where you have the JDK installed).

What exactly does your PATH look like; what do you get as the answer from the following command: echo %PATH%

Did you also set a CLASSPATH? If yes, then unset it (delete the environment variable).

Where do you get this "Unable to locate the Javac Compiler" error message? On the command prompt, when you try to compile a class? Or in an IDE? If it is in an IDE, then point the IDE to your JDK directory, not the JRE directory.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
Thanks very much for your reply.

I am using the Eclipse. How do I point Eclipse to JDK instead of JRE? Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Eclipse doesn't need a JDK, because it has its own built-in compiler. It should work with just a JRE. Maybe you're using some plug-in that needs a Java compiler inside Eclipse.

But... You can go to Window / Preferences / Java / Installed JREs and add your JDK there.
Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
Thanks for your prompt reply. I have successfully get rid of the problem.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cannot Find javac
 
Similar Threads
Creating a PATH?
Java\bin PATH setup
MVC example
'javac' is not recognized as an operable program or batch file
Trying to install JAVA JDK