Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Programmatically inserting into a jar

 
Tom Fotherby
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • 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
  • 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"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah - that little "applet" word.
Let's tranfer this to the Applets forum and see what they say.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic