Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Class is public, should be declared in a file

843810Nov 17 2007 — edited Feb 20 2008
Hi Guys,
�Class is public, should be declared in a file�. I have absolutely no idea what that error means in my case.
I am using NetBeans to compile my application. One of the jar files has inside a few *.java files. When I compile the app, NetBeans (which is done by ant inside NetBeans ) I get this error �Class X is public, should be declared in a file named x.java�, but the java files are inside the jar file � I don�t want to compile them.
If I remove *.java files from the jar file it compiles OK, but why javac tries to compile *.java files from the jar files that are just on the classpath � that is a mystery.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 19 2008
Added on Nov 17 2007
5 comments
835 views