• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class-Path attribute in JAR manifest & class loader

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic