File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Classpath inside Jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Classpath inside Jar" Watch "Classpath inside Jar" New topic

Classpath inside Jar

Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4200

Hey guys,

I'm putting some stuff in an executable Jar, and I'm wondering, do the classes/packages always need to be found at the top level?

For instance, if I have a package named, does the org folder need to be at the top level, or can I put all my packages in a folder named bin, and set the classpath to this folder?


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Since packages has been stuffed into the JAR file, only jar file name can be set in the classpath... And org folder should be at the top level, Then only JVM can make search into the jar and visits the folder correctly

SCJP 6 [SCJP - Old is Gold]
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4200

Thanks man. Bit of a pity.
I agree. Here's the link:
subject: Classpath inside Jar
It's not a secret anymore!