• 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

getting the name of a jar file from inside the jar

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jar. This jar has code in it similar to this:

studyJar is a JarFile representation of the jar this code is executing in. I get studyID and studyVersion from a text file located inside the jar.
I need to add the functionality where the jar can be renamed by end users.
Is it possible for code inside of a jar to get the name of the jar it resides in? I need its name to instantiate the JarFile above.
Thanks,
[ March 28, 2002: Message edited by: Jason Kretzer ]
 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you do not believe it to be possible at least tell me that. I don't want to waste my time looking for something that is not there.
Thanks,
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is one solution. It's painful. I hope there is a better way, but I don't know one.
Grrr. HTML is not enabled.

[ March 28, 2002: Message edited by: David Weitzman ]
 
Author
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jason,
I haven't tried it but if you have the JarFile object, the getName() method that is inherited from java.util.ZipFile might help.
 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I need the name of the jar to instantiate the JarFile object to begin with.
Thanks though,
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic