2

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.

Community
  • 1
  • 1
Neil
  • 5,919
  • 15
  • 58
  • 85

1 Answers1

1

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.

Dmitry Leskov
  • 3,233
  • 1
  • 20
  • 17
  • thanks for your answer , I had evaluated this software earlier but could not use because it does not support Java7 . is there any work around ? – Neil Nov 28 '12 at 09:20
  • Yes, we are a bit late with Java 7. Sorry about that. We are busy with the 64-bit version atm, so will only start working on Java 7 early in 2013. – Dmitry Leskov Nov 28 '12 at 11:32
  • 2
    7-Zip SFX works with the private JRE too - check out the KB article. – Dmitry Leskov Nov 28 '12 at 11:36
  • @Dimitry hmm.. but I am using JavaFx latest stuff so can't downgrade my Java version for recompilation. – Neil Nov 28 '12 at 12:57
  • the SFX method works wonderfully but the problems my application directory contains about 200mb of mp3 files which is streamed when the program runs. Since they don't get compressed much my final standalone executable becomes very large (221mb) hence long start up time (long time extracting ). Anyway solution comes to your mind ? – Neil Nov 28 '12 at 13:20
  • JavaFX 2.2 Runtime is available for Java SE 6 as a separate download, and the current Excelsior JET can be tweaked to work with it: http://www.excelsior-usa.com/blog/excelsior-jet/javafx-2-already-supported/ – Dmitry Leskov Nov 29 '12 at 05:13
  • 2
    Leave those MP3s on the DVD as separate files, then use the environment variable trick at the end of our KB article to obtain the path to the SFX and get the drive letter from it. – Dmitry Leskov Nov 29 '12 at 05:17