• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class-Path attribute in JAR manifest & class loader  RSS feed

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to call other jar files from current jar?

I try this:

Main-Class: CompressUtil
Class-Path: D:/my/lib/tar.jar D:/my/lib/activation.jar

but doesn't work. any idea? (I don't want to include those jar)

I read somewhere in google, need to use class loader, anyone can show me how?

thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A ClassPath in a jar file manifest must be relative to the jar file itself, not to the local file system. The convention is to simply list the jar file name without a path and plan to keep it in the same directory as the jar file you're creating.

So, you'd want to change your entry to:

Class-Path: tar.jar activation.jar

Another quirk of manifests in jar files is that you must have an extra line feed character at the end of the file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!