Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 Murach's Java Servlets and JSP this week in the Servlets 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: 3575

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?

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: 3575

Thanks man. Bit of a pity.
It is sorta covered in the JavaRanch Style Guide.
subject: Classpath inside Jar
Similar Threads
Eclipse Workspace, can you collapse a package directory structure?
How to access an applet from a folder inside a jar file -- Urgent
Jars & Zips & Classpath
Can't find ..\lib\ext\ packages