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.
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.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: May 31, 2002
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
Joined: Sep 29, 2000
Ah - that little "applet" word. Let's tranfer this to the Applets forum and see what they say.