I could really use some help if someone knows how to do this. I have installed jdk1.6.0 on my laptop. The path is set to: C:\Program Files\Java\jdk1.60\bin\;. I also have the ClassPath set to the same setting. When I try to compile a program I get the following error: "javac: filenot found:program name.java usage: javac<options><sourcefiles> use -help for a list of possible options. Thanks. Tom.
As Sagar points out, the "file not found" message tells us that the problem is that the compiler (i.e. javac) is not finding your java file. But first. there is some house keeping to do with your CLASSPATH environment variable. Remove the "C:\Program Files\Java\jdk1.60\bin\" from your CLASSPATH environment variable. (And change the name of it to all upper case if it is not). You don't need (or want) the java bin directory in your classpath. Keep the "C:\Program Files\Java\jdk1.60\bin\" in your PATH. Set your CLASSPATH environment variable to "." (Just a period without the quotes.) The period means the current directory. While not explicitly needed, it is often very helpful, especially when one class you are compiling is dependent on another class in the same directory.
To compile your file... Let's say the java file 'MyJavaClass.java' is located at "C:\projects\src\MyJavaClass.java". And I want to compile it. We need to change directory to the same directory as the java file (assuming your class is not in a package)and then compile it: <blockquote>code:<pre name="code" class="core"> C:\> cd \projects\src C:\projects\src> javac MyJavaClass.java </pre></blockquote>
Alternatively, if you don't want to change directory to the directory that has your java file in it, you can specify the full path to where your file is: <blockquote>code:<pre name="code" class="core"> C:\> javac C:\projects\src\MyJavaClass.java </pre></blockquote>
If you have other class in that directory that MyJavaClass depends on, you need to have that i your classpath; this can be done at the command line: <blockquote>code:<pre name="code" class="core"> C:\> javac -classpath "C:\projects\src\" C:\projects\src\MyJavaClass.java </pre></blockquote>
Give that a try. If you are still having problems, let us know.