• 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

accessing a jar with in a jar

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This following URL points a jar file called bar.jar within the bar directory.
jar:file:/bar/baz.jar!/
This URL points to a class with that jar file.
jar:file:/bar/baz.jar!/MainClass.class
I thought that logically it should be possible to access a jar within a jar with:
jar:file:/bar/baz.jar!/innerJar.jar!
Why do i get problems when trying to open a JarURLConnection to this url? I'm basically trying to create an executable jar which runs other executable jars which are contained within it. Any ideas people?
Here are different combinations of url i tryed:
jar:file:/bar/baz.jar!/innerJar.jar!
error message: innerJar! not found
jar:file:/bar/baz.jar!/innerJar.jar!/Manifest.mf
error message: FileNotFoundException
jar:file:/bar/baz.jar!/innerJar.jar
this works but the JarURLConnection points to the baz.jar file and not the innerJar.jar
Is is possible to access a jar with in a jar or do i need to first extract it?
thanks in advance
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patrick,
Yes, it is possible to nest jar files. But then in the Classpath of the Manifest of the root jar you have to specify the relative path to the inner jar files.
Not sure if that answers your question,
Hope this helps.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic