Compiler errors

When compiling a java program, i get the following message: "class XXX is pubilc, should be declared in a file named XXX.java". The file is stored in a jar file and the classpath settings are correct. Any ideas?
[225 byte] By [meek_long] at [2007-9-26 4:02:49]
# 1

> When compiling a java program, i get the following

> message: "class XXX is pubilc, should be declared in a

> file named XXX.java".

The problem is that the name of the file must match the name of the public class it contains (and don't forget, the names are case sensitive). For example, if you have the public class "MyGoodOlClass" in your source file, then the name of the file must match:

MyGoodOlClass.java

Check the .jar file whether the name stored is correct.

> The file is stored in a jar file and the classpath settings are correct.

Is it really necessary for you? I suppose the .jar file is given to javac using the -sourcepath command line argument, but it just makes your life harder IMHO.

ivanhu at 2007-6-29 12:59:50 > top of Java-index,Developer Tools,Java Compiler...
# 2
Take the source file out of the JAR file to compile it. For compiling, you need to use -sourcepath as well as classpath. Source files (I think) aren't read off of classpath.
marsmaniac at 2007-6-29 12:59:50 > top of Java-index,Developer Tools,Java Compiler...