Search code examples
windowsexejavalauncher

Windows exe launcher for Java app with JRE check


I need to distribute a Java application and I want an installer to install it in all cases.

I need to create an *.exe launcher that will check the installed JREs and

  1. if the required JRE isn't installed, show a window with a proper link.
  2. if required JRE is installed, launch the properly executable jar file.

Solution

  • I'm pretty happy with WinRun4J: http://winrun4j.sourceforge.net/

    It's under active development and some improvements I suggested were quickly implemented.

    The only thing that is currently lacking (from my point of view) is to specify a "relative" path to the JRE to allow bundling a JRE with the application.

    To spare you the effort of reading the manual, this is what I do for my launcher:

    Rename WinRun4j.exe to MyApp.exe, then:

    rcedit /C MyApp.exe
    rcedit /I MyApp.exe myapp.ico
    rcedit /N MyApp.exe MyApp.ini
    

    Put into a nice little batch file and there is no "manual" stuff to do.

    You only need to do this once (and if your library path changes)