• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling error

 
Charlotte Queenan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11064
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
How are you trying to compile your source file. Command line?
 
Charlotte Queenan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11064
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11064
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error
States " The system cannot find the path specified"
 
Maneesh Godbole
Saloon Keeper
Posts: 11064
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12143
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic