[JAVA HELP] Help with javac

Status
Not open for further replies.

fasihxkhatib

Distinguished
Aug 25, 2011
74
0
18,580
0
Im an absolute beginner to Java and im learning from
Beginning Java by Ivor Horton

I installed JDK 7 and did change the path variable to point to the bin directory in the root folder.
however when i issue this command from cmd, I get this error
Command: javac MyProgram.java
Error: file not found.

Now this is not posible cause I have checked that the file is there.
The same thing seems to work fine with Jcreator LE.

So my two questions are:
1. How do I resolve this javac error?
2. If I want to save all my source codes to another directory (lets assume a directory named SourceCode on Desktop) then what changes have to be made???

ps: Im an absolute noob.
 

randomizer

Distinguished
Jul 24, 2006
880
0
19,260
62
Are you issuing that command from the directory where MyProgram.java is? If you don't specify a path but just a filename, Windows looks for it in the current working directory. Remember that you'll have to use the cd command to navigate to the directory with the file before running it, or specify the absolute or relative path to the file from the default working directory (which is C:\Users\%USERNAME%).
 

randomizer

Distinguished
Jul 24, 2006
880
0
19,260
62
Are you issuing that command from the directory where MyProgram.java is? If you don't specify a path but just a filename, Windows looks for it in the current working directory. Remember that you'll have to use the cd command to navigate to the directory with the file before running it, or specify the absolute or relative path to the file from the default working directory (which is C:\Users\%USERNAME%).
 
Status
Not open for further replies.

ASK THE COMMUNITY