• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Class-Path manifest attribute

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can this attribute be used to locate a jar within a jar? Specifically, I am working on a project where our class files are packaged in wcd.jar. We need to also distribute xerces.jar (or whatever the name is, that's not important here) with our application for XML DOM stuff. If we package xerces.jar inside of wcd.jar, can add something like

to the manifest file to locate it?

If not, how do we add xerces.jar to the classpath? We want this to be as painless as possible for our client.

Thanks in advance.

Layne
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Can this attribute be used to locate a jar within a jar?



No (I have seen countless people try).
You could specify a JAR file as you have done and just make it available to the class loader (i.e. put xerces.jar in the VM execution directory "user.dir").

Alternatives include:
- Packaging all classes into one big JAR (nasty)
- Write your own class loader that does whatever e.g. look up the 'a' attribute in the 'f' file and expect jars to be in that directory and load classes from there
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your comments, Tony. I just want to clarify a little bit here. We want to be able to install our application on the customer's machine as seamlessly as possible. For our initial alpha release, we packaged everything in a single JAR and the customer only has to copy this jar to any where on his system. We really don't have the time to write any kind of installation software since this project must be finished within the semester and we already have our plate full with fulfilling the customer's requirements.

In short, we need a quick and dirty way to locate these third party JARs that we are using for our next alpha release when it is installed on the customer's system. If we have to give the customer three separate files, that might be satisfactory. So my next question how does the Class-Path attribute resolve relative paths? Is it resolved relative to the location of the JAR or relative to some other directory?

Layne
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
relative to System.getProperty("user.dir")
...off the top of my head - I may be wrong, give it a try.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! I think one of the other team members has been fiddling with this as well. I sure hope we can figure it out. Our next alpha release is due next week. We don't have much time to test it to make sure it's worthy to release to the customer *sigh* It's going to be a long week.

Layne
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic