wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Installed JDK but javac not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Installed JDK but javac not working" Watch "Installed JDK but javac not working" New topic

Installed JDK but javac not working

John Reese

Joined: Apr 04, 2009
Posts: 7
I am running windows vista. I have a 64 bit operating system.

I installed this JDK:
"Windows x64 80.25 MB jdk-7-windows-x64.exe" from this webpage: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

I created a HelloWorld.java file to a folder

In windows start menu, I typed cmd

I navigated with the command prompt to the appropriate folder and after confirming my file was there, I typed:
javac HelloWorld.java

I get the error:
'javac' is not recognized as an internal or external command, operable program or batch file.

I removed and reinstalled the jdk... but had the same problem.

I restarted the PC... but still had the same problem.

EDIT: SOLUTION for future Googlers and Salooners...

The problem was 'environmental variales'. See: http://download.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#path
then go to the part of the page where it says: "Updating the PATH Environment Variable (Optional)" [Actually, the word 'optional' is misleading I think; it's the only practical option.]
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
check your environment variables (path and classpath).
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

John Reese wrote:"Updating the PATH Environment Variable (Optional)" [Actually, the word 'optional' is misleading I think; it's the only practical option.]

No, it is not... In the case where you have to manage multiple versions of the same code for maintenance reasons, then you might end up with multiple JDK installed on your computer. Then you would like to use the one that corresponds to the released version and not a system default. So then you need to set the PATH to the JDK with a script, have a build tool like Maven or Ant keep track of it or use an IDE such at Netbeans or Eclipse.

I agree that when starting to learn Java, that is what you should do. Most newbie tutorials I've seen walks you through this step of setting up the PATH variable.
I agree. Here's the link: http://aspose.com/file-tools
subject: Installed JDK but javac not working