Hello, I have just started in a java class and having trouble with first assignment. Our first assignment was to enter into Notepad++ and enter a java program provided to us. I did this and saved the program as Quiz1.java.
The next step was to compile the file using the javac compiler. I open the command window and typed javac Quiz1.java. When I do this it says javac:file not found:Quiz1.java

I am not sure what I am doing wrong

I open the command window and typed javac Quiz1.java. When I do this it says javac:file not found:Quiz1.java

Where is the Quiz1.java file? Is it in the 'current directory'? Use the dir command to see what is in the current directory and use the cd command to change directory to where the missing file is.
If you need further help, copy and paste the contents of the command prompt window here.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\ADMIN>dir
Volume in drive C has no label.
Volume Serial Number is 5032-0C20

Directory of C:\Documents and Settings\ADMIN

09/06/2010 02:59 AM <DIR> .
09/06/2010 02:59 AM <DIR> ..
09/04/2010 01:41 PM <DIR> .nbprofiler
09/04/2010 01:40 PM <DIR> .netbeans
09/06/2010 03:02 AM 0 cd
09/04/2010 01:46 PM <DIR> Desktop
09/06/2010 02:55 AM 0 echo
08/31/2010 06:42 PM <DIR> Favorites
09/06/2010 02:49 AM 0 java
09/06/2010 03:00 PM <DIR> My Documents
09/04/2010 01:43 AM 0 path
08/31/2010 06:05 PM <DIR> Start Menu
4 File(s) 0 bytes
8 Dir(s) 49,400,090,624 bytes free

C:\Documents and Settings\ADMIN>javac Quiz1.java
javac: file not found: Quiz1.java
Usage: javac <options> <source files>
use -help for a list of possible options

C:\Documents and Settings\ADMIN>

i have saved it in a new folder in my documents and to my flashdrive

The results of the dir command does NOT show a .java file in the directory???
You need to change directory (use cd command) to the directory containing the .java file.

to go to my documents from where you are there type: cd "My Documents", then type: cd "folder you saved to", then type: javac Quiz1.java

Edited 6 Years Ago by Akill10: n/a

my friend when i started i got the same prob as you do.Now follow these steps.

1.when you have completed you code.
2.go to file and open my computer.
3.after that open c drive.
4.Then open program files folder in C.
5.open the java folder in program files.
6.now if you have install your JDK perfectly then you will have jdk folder open that jdk folder.
7. then open bin folder in that.
8.Now save your file Quiz1.java in it.

SO NOW YOU WANT TO COMPILE IT THROUGH COMMAND PROMPT FOLLOW THESE STEPS.

1.Open command Prompt
2.type cd \
3. then type cd program files.
4.Now type cd java.
5.Then type cd jdk but remeber you have to type full version of jdk like mine is e.g
cd jdk1.6.0_20 if you have the same you type the same but if your jdk version if different type your's one.
6.Now type cd bin.
7.last step is type javac and your file name Quiz1.java and press enter.

try it.

Edited 6 Years Ago by extemer: n/a

7. then open bin folder in that.
8.Now save your file Quiz1.java in it.

Do NOT put your files in the JDK folders!!!!

read care normR1 i have written that open jdk folder and then open bin folder in that and now save your file in it.

open bin folder in that and now save your file in it.

Do NOT put your files in any of the JDK's folders. The bin folder is one of the JDK's folders.

Keep your files completely separated from any of the JDK's folders.

Edited 6 Years Ago by NormR1: n/a

You can do what you want of course.

I was trying to tell the OP that putting files into any of the JDK's installation folders is a bad technique. Keep your stuff away from the java product folders.

This article has been dead for over six months. Start a new discussion instead.