File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes compiling error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling error" Watch "compiling error" New topic
Author

compiling error

Charlotte Queenan
Greenhorn

Joined: Feb 08, 2011
Posts: 4
I have just started Java and can't get my computer to compile any of the programs as the error that keeps appearing is that the file does not exist. Any suggestions?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Welcome to the Ranch.
How are you trying to compile your source file. Command line?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Charlotte Queenan
Greenhorn

Joined: Feb 08, 2011
Posts: 4
I am using the command prompt, although when I change the directly and try to find the file it says it doesn't exist.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Trouble shooting I
I know this is kind of silly, but have you saved the file as .java after writing the code? Do you see the .java file in your explorer?

Trouble shooting II
Let us imagine your source file (MyFirstApp.java) is located under c:\MyApps.
To compile it, you need to
1) Navigate to c:\MyApps
2) Run the command javac MyFirstApp.java*

*I have intentionally highlighted the 'c' and 'java' parts because those are one of the typical mistakes beginners do.
Are you following the corresponding steps? Do you still get the error?

Trouble shooting III
If the above dont work, can you copy past the actual error?

Charlotte Queenan
Greenhorn

Joined: Feb 08, 2011
Posts: 4
Yes the. Java is at the end of the filename and its in my documents, not my explorer. Should it be in the explorer and if so how would I save it there?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Charlotte Queenan wrote:Yes the. Java is at the end of the filename and its in my documents, not my explorer. Should it be in the explorer and if so how would I save it there?


.Java? Does it say .Java instead of .java? In Java case does matter. If yes, you will need a .java file
By explorer, I meant the explorer window where you see all the files and folders on your system. If it is in my documents it is ok.

I would recommend you confirm the extension for .java then try out the steps I mentioned in Trouble Shooting II above.
If you still get the error, please copy paste the error here
Charlotte Queenan
Greenhorn

Joined: Feb 08, 2011
Posts: 4
The error
States " The system cannot find the path specified"
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Maneesh Godbole wrote:
If the above dont work, can you copy past the actual error?


Maneesh Godbole wrote:
If you still get the error, please copy paste the error here


What I meant was can you copy paste the stuff displayed in your command prompt. Check sample below



fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11498
    
  16

Charlotte Queenan wrote:The error
States " The system cannot find the path specified"

Charlotte,

You really need to give us as much information as possible for us to help you. this alone is not enough. What exactly do you type on the command line? What directory are you in? What directory is the .java file in?

All of these things matter. The more information you give, the easier it is to figure out where the problem is.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Another suggestion:

Are you on Windows? Are you using Notepad as a text editor? Do you have the "hide extensions for known file types" option in "file options" ticked? In that case, Notepad is capable of saving your work as MyClass.java.txt and the "hide extensions" pretends the .txt extension isn't there.
Don't use Notepad; try Notepad++ Notepad2 or jEdit (or other suggestions you will find in this forum).
 
jQuery in Action, 2nd edition
 
subject: compiling error