This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot Find javac

 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15364
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15364
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your prompt reply. I have successfully get rid of the problem.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic