Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Installed JDK but javac not working

 
John Reese
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check your environment variables (path and classpath).
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic