Reputation: 477
I have written an updater program for my friend to update another program I wrote for her as a going away gift. I have written all the needed code for retriving the class files that are updated from a server and holding them in temporary memory. What I need help with is having the program replace the class files in the first jar file so she doesn't have to do manual updates. Note: The main program is not running during update so no exploding jars.
Upvotes: 1
Views: 247
Reputation: 6665
If Java Web Start is not what you're looking for and if the jar
executable is available on your friend's computer (either because a JDK is installed on your friend's machine or you distribute it with your application), you can run
jar uf
jar-file input-file(s)
If you want to call the jar
executable from within a Java program, just use Runtime.exec
. For a more in-depth discussion about updating a JAR via the jar
executable, see Sun Developer Network's article "Updating a JAR File."
Upvotes: 2
Reputation: 168825
So long as the app. has a GUI, deploy it using Java Web Start.
Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation1 for platforms that support Java.
JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update2 (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..
Upvotes: 2