> 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.