posted 11 years ago
Is there a way I can modify the contents of a file inside a jar file? I have tried different options but haven't succeeded. I just have a war file that does not have any contents inside the classes folder, but has all the working code inside the lib folder (jars). One of these jar files say (my1.jar) has a text file say (sample.txt) packaged along with it. I am able to read the contents of the file (sample.txt) from the code in my1.jar using (getClass().getResourceAsStream("path to sample.txt")). I just am curious to know whether I will be allowed to modify the content of the file (sample.txt).
my.war
|
|---META-INF
|
|---WEB-INF
|
|-- classes (empty)
|
|--lib
|
|---my1.jar
|---my2.jar
my1.jar
|
|--- META-INF
|--- com
|--my
| |
| |--file
| |
| |--sample.txt
|--MyClass (I am able to read the contents of the file from this class)
I am not able to create a file object of 'sample.txt' file. The Url obtained just does not start with 'file://..'(hierarchial) its opaque as ('jar:file://....'). I dont have a way to created a output stream either!
Any help is greatly appreciated.
Regards