Command line can't find .java file from desktop

Closed
zlloyd1 Posts 10 Registration date Tuesday December 11, 2012 Status Member Last seen February 4, 2013 - Dec 15, 2012 at 07:54 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Dec 16, 2012 at 09:17 AM
Hello,
I am not sure if this is the right place for this question, but I am having a problem running a Java program I wrote from the Windows 7 command prompt. I have saved the file as a .java extension on my desktop. Then, I open a command prompt and change to the desktop directory. Then I type in javac testnew.java and hit enter. Then I get an error that says,
"javac: Filenot found: Testnew.java
Usage: javac<options><source files>

but I know the file is there, I opened the command prompt right beside it on my desktop. Perhaps this is not the correct forum for this, but it says Programming forum, so I thought I would see if I could get some clarity on what is happening here....
Oh, and thanks in advance!!

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Dec 16, 2012 at 09:17 AM
Is your class name same as your file name ? Class name must match the file name.

You have not added any Package statement in your java file ? The java file must exists in the folder as defined by Package instruction in java file
0