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!

javac and zip/jar files that contain only sources

843810May 1 2002 — edited Oct 28 2005
My program depends upon library classes written by someone else. These are distributed in a zip file containing only the .java files. I want to include that zip file in my javac sourcepath so that the classes will be compiled into the same place as the class files from the code I have written.

I'm using the command:

javac -d ../build -sourcepath .;..\lib\lib.zip mypackage\myclass.java

When executed I get an error for every one of the third party files saying "class x is public, should be declared in a file named x.java". It IS in a file named that, it's just that the file is inside a zip. The compiler is obviously finding the file.

Is this a limitation of javac? If so, it's not one that I can find any documentation for.

I know I can just unzip the thing, but I'm trying to put together an idiot-proof distribution and I'd like to include the 3rd-party stuff (which is open source) in exactly the format it's distributed in.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2005
Added on May 1 2002
3 comments
932 views