• 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

Programmatically inserting into a jar

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I insert a file into a preexisting jar file programmatically?
Background. I want an applet to load an XML file and the only way I can easily read the XML is using this.getClass().getResourceAsStream("backup_specFile.XML");
This is fine except the XML file is created dynamically after the program is all jarred up. So I need to insert the XML file into the jar.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does it have to be IN the jar. Couldn't it just be in the classpath? Of course you would need to be sure that there was not another file with the same name that was IN the jar.
 
Tom Fotherby
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aren't classpaths irrelevant to applets? To read in a file from an applet I thought that the only thing to do was to include the file inside the applet jar file and use
Inputstream usethis.getClass().getResourceAsStream("specFile.XML");
Any other suggestions to read in a file from applets would be welcome
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah - that little "applet" word.
Let's tranfer this to the Applets forum and see what they say.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic