English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have installed the Java 2sdk_1.4. Path setup has also been set up successfully. Now the thing is that when I compile my application"Hello.java" in the Ms-dos. It gives error like
error: cannot read: Hello.java
1error
Is anyone could help me to find out this problem
Thanks

2007-02-25 21:36:36 · 2 answers · asked by M Z 1 in Computers & Internet Software

2 answers

It is possible that you are not in the same directory as the file when you are attempting to compile.
1. if you are typing javac Hello.java, make sure the prompt is in the same directory. For example, if you created the Hello.java file in C:\Test make sure the dos prompt is at C:\Test when you type javac Hello.java OR alternatively, if you didnt change the directory of the prmpt make sure you type javac C:\Test\Hello.java from the prompt.

2. Make sure the class specified in the file matches the actual file name. For example, public class hello{} must be in a file called hello.java, while public class Hello{} must be a file called Hello.java---notice that capitalization is NOT ignored.

Good luck.

2007-02-27 04:15:36 · answer #1 · answered by AL L 2 · 0 0

Chech that u have used camel casing for the main class name and also that main class name is same as the file name Hello.java.
and u are writing the same in the command prompt while compiling.

2007-02-25 21:40:32 · answer #2 · answered by AJosh 1 · 0 0

fedest.com, questions and answers