Reputation: 6039
I am shipping private JRE along with jar program in the DVD. It takes about 3 minutes if I directly run the program from the DVD. Probably it takes time to load the JRE libraries to main memory as optical disks speed is slow. However when I close the program and re-launch , it gets launched instantaneously as if JRE is installed in the local computer (which is not). I think JRE stays in the memory even after I close the program.
3 minutes is a big waiting time for users, is there any way I can optimize the code (which is the only thing under my control) that it loads only few libraries to launch and load the the other necessary ones on demand. Now probably it is trying to load everything from DVD before showing the program window as suggested by
$java.exe -verbose -jar myProgram.jar
Is there any other solution to launch the program quickly even in the 1st time ? Currently the only workaround is to use the Launch4J .bmp splash screen buts that is very static.
Note: I know installing JRE in local machine will solve the problem but the program is not for technical users, my Launch4J does not find it if installed in custom directory. Also my DVD is copy protected so that the program can not be distributed.
Upvotes: 2
Views: 373
Reputation: 3165
Package your app together with the private JRE into a single EXE that would self-extract into the user's temporary directory and automatically run your app. The startup time improvement will blow you away:
http://www.excelsior-usa.com/blog/excelsior-jet/java-app-as-a-single-exe/
(Download the sample packaged apps and burn them onto a DVD to quickly verify my claim.)
Let me emphasize that you can achieve the result using free tools only, and optionally improve it a bit further with Excelsior JET. Refer to our Knowledge Base article for full instructions (most of which apply whether you use Excelsior JET or not):
HOWTO: Create a single EXE from your Java application
Disclaimer: As you may have already guessed, I work for Excelsior. But again, it all works for the private JRE, and the result, in terms of startup time improvement, is almost as good.
Upvotes: 1