I hav given the name of file as class name and saved it as .java by creating a folder in c drive.when i try to compile it shows the following exception.pls help me to resolve from this problem

C:\Program Files\Java\jdk1.7.0\bin>javac HelloWorldApp.java
javac: file not found: HelloWorldApp.java
Usage: javac <options> <source files>
use -help for a list of possible options

thank u

Recommended Answers

All 4 Replies

since i din set the path,i tried as given below also

C:\Program Files\Java>C:\Program Files\Java\jdk1.7.0\bin\javac HelloWorldApp.jav
a
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

but tis too lead exception,pls do help


thank u

Windows and spaces in the files/folders names (puke face here). See this article for Java installation, you will find there also how to set PATH for various OS

you do not set the path correctly ,for setting the path go to my coputer and right click on this then click on adavanced tab then click on environmental variable button add a new user by click on new button then enter the path and set the variable value to the bin folder in the jdk directory.

What you have used above will work, but you need to point to an existing Java source file. Try putting it on your Desktop and trying something like this:

C:\Program Files\Java\jdk1.7.0\bin>javac C:\Users\MyName\Desktop\HelloWorldApp.java

Adding the JDK to your system path is a more long-term solution, which would allow you to call javac directly from the same folder as your source code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.