Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to update an entry in an executing Jar file?  RSS feed

 
Simon Machin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing an executable Jar file which contains one class (to FTP data to another machine) and one properties file (which contains amonsgst other things a unique sequence number to go in each new filename).
Each time the Jar executes, the last thing it must do is increment the sequence number by one. Unfortunately I can't do this while it's in the Jar file. I know of a method whereby you create a temp jar file, add your new entry then copy the remaining files. Finally you would delete the original and then rename the temp.
Which would be great if I didn't have a lock on the jar file because it's being used to run the program in the first place.
D'oh!
So, to cut a long story short - Is it possible to update one file (ie overwrite an existing entry) in an executing jar without having to rewrite the entire thing?
Many thanks
[ June 19, 2002: Message edited by: James Mills ]
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. But it would be possible to have a separate parent process in charge of renaming the jar. Instead of running program.jar (or whatever it's called) as you usually might, call launcher.jar which will in turn call program.jar and do the renaming when everything is done.
 
Simon Machin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a good idea, I'll give it a go.
Cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!