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 javac cannot find Helloworld file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac cannot find Helloworld file" Watch "javac cannot find Helloworld file" New topic
Author

javac cannot find Helloworld file

Titu Jack
Greenhorn

Joined: Mar 24, 2012
Posts: 2
When i type javac in command prompt i get right response. But when i try to compile my "helloworld.java"file , cmd dont find any java file.
Then these lines appears .
Javac:file not found:HelloWorld.java
usage:javac <options> <source files>
use -help for a list of possible options.
now what should i do. Please help me.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
Welcome to the Ranch

Please don’t post a new question on an old thread. I have split your question into a new thread.

That error message confirms you have set your PATH correctly.

What files do you have in the current directory? Use the dir (or ls) command to check that you actually have the HelloWorld file in the correct directory.
Check you have spelt it correctly: Helloworld ≠ HelloWorld
Are you using javac or Javac?
Have you set a classpath? Find out what it is with echo %CLASSPATH% (Windows®) or echo $CLASSPATH (*nix).
If the classpath is not empty, try javac -cp . HelloWorld.java; if that works, you probably have a classpath problem.
Setting a system classpath usually does more harm than good. If you set it yourself, delete it. If nothing comes up, do nothing. If something comes up which you didn’t set (often caused by installing QuickTime), edit the classpath by adding .; (Windows®) or .: (*nix) at its beginning.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

Titu Jack wrote:...when i try to compile my "helloworld.java"file , cmd dont find any java file.
Then these lines appears .
Javac:file not found:HelloWorld.java

Your Class name and the filename must be EXACTLY the same. If your file is really "helloworld.java", (all lower case) then the class name inside must be "helloworld" (again, all lowercase). There is a discrepancy somewhere, since the compiler is telling you it is looking for "HelloWorld.java"

Even when you type the javac command on Windows (which is case insensitive), it is passing that along to the java compiler, which is NOT case insensitive, so you still have to do it correctly.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Titu Jack
Greenhorn

Joined: Mar 24, 2012
Posts: 2
As i have told before that i cannot compile my "HelloWorld.java" file. Cmd cant find this file. Now i want to know what i should set or write in both user and system environment variables. At the moment
You can assume that i have installed jdk properly in default way. You can also assume i have not set any user or system environment variables. Please show me what should i write in both user and system enviornment variables.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

it is kind of impossible for us to tell you what to put in your environment variables since we have no idea what your environment is.

if you 'cd' to the directory where your HelloWorld.java file is, and you are not getting a 'command not found' error, then it should work - assuming everything is what you tell us it is.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javac cannot find Helloworld file
 
Similar Threads
javac complications
problem with PATH and PATH variables
java in linux
javac options
Compiler