Hi,
I've been working on an application, a sort of a
test engine. The structure of the app is something like this -
TestEngine.jar (All the classes needed to run the app)
|
|
Resources.jar (Some text files, from which the questions and answers are read)
Reading from the jar files is no problems. But writing to jar, i.e. Resources.jar is not working properly the first time round. Here's what's happening -
The class files from TestEngine.jar read from text files of Resources.jar, extract these text files on user's home directory and make changes to these files (in the home dir itself). After that, I'm trying to update the text files in Resources.jar with the new updated text files from user's home directory. Here's he code I'm using to update the text files in the Resources.jar file -
I'll try explaining step by step, what's going on in my application -
1) I launch the GUI app, where, upon logging in as "Admin" the text files from Resources.jar are extracted (rather copied) on User's Home Directory (UHD). Along with this, the getReady() method of above class is called. This method displays the paths of the files in UHD properly, meaning UpdateJar class CAN see these files in the first run of the application too.
2) I am able to make changes to these text files on UHD through my program. The files on UHD are modified properly.
3) Next, I try to call commitUpdate() method of Updatejar class above, method runs without any exceptions and prints both p.waitFor() and p.exitValue() results as 1, which is supposed to be 0 for successful operation.
4) I close the application. The text files are still there on the UHD.
5) I again launch the application, go through the steps 2 & 3 again and this time, commitUpdate()'s p.waitFor() and p.exitValue() both return 0 and my Resources.jar file is actually properly updated with the modified text files from UHD.
I've been trying to resolve this issue since few days now.. I've tried several different ways, nothing works properly. I'm getting this same problem mostly - not updating the Resources.jar in the first run. I'll really appreciate it if anyone can please help me figure out what I need to do here to make this thing update from the first run itself?
