Alright so I've installed the JDK (1.6.0_22 to be exact) and I'm running windows 7. I've typed in to my command prompt and I get the version of the JDK so that works. But when I try compiling a example.java file it says . I've gone into the environment variables and added a variable name "path" with a variable value of "jdk....\bin
What should I do from here to get it to work?
So we can see what's going on, copy and post the entire output from:
> javac -version
> javac example.java
"dir" is to check that example.java really does exist and is in the right place. You do have to run javac.exe from the right place so that it "sees" example.java.
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
Volume in drive C is Windows
Volume Serial Number is 3C2C-AC2E
Directory of C:\Users\George Kennedy
10/27/2010 08:15 PM <DIR> .
10/27/2010 08:15 PM <DIR> ..
10/17/2010 02:46 PM 145 .appletviewer
10/10/2010 07:39 PM <DIR> bluej
10/03/2010 11:07 AM <DIR> Contacts
10/27/2010 08:59 PM <DIR> Desktop
10/18/2010 11:18 PM <DIR> Documents
10/26/2010 11:40 PM <DIR> Downloads
10/03/2010 11:07 AM <DIR> Favorites
10/03/2010 11:07 AM <DIR> Links
10/03/2010 11:07 AM <DIR> Music
10/17/2010 02:19 PM <DIR> myfolder
10/03/2010 11:07 AM <DIR> Pictures
10/03/2010 11:07 AM <DIR> Saved Games
10/03/2010 11:07 AM <DIR> Searches
10/18/2010 11:33 PM <DIR> Videos
10/03/2010 11:07 AM <DIR> Virtual Machines
10/17/2010 02:43 PM <DIR> Week 02
1 File(s) 145 bytes
17 Dir(s) 449,938,161,664 bytes free
C:\Users\George Kennedy>javac -version
C:\Users\George Kennedy>javac HelloWorld1.java
javac: file not found: HelloWorld1.java
Usage: javac <options> <source files>
use -help for a list of possible options
Thanks it worked i realized what i did
OK, so that explains the OS message: there is no HelloWorld1.java in the "C:\Users\George Kennedy" folder.
Navigate to the folder that contains the java file and try the javac command again.
Great! I'm glad you've got the compiler working. Now all you have to do is figure out the innumerable compiler messages that it will deliver you ;)