JAR installer that auto-detects if Java is there and autostarts the application

前端 未结 6 1637
忘掉有多难
忘掉有多难 2020-12-17 02:55

I need to build an installer that does the following:

  1. Installs my jar on the client.
  2. Auto-detects if JRE is installed (in which case it does not re-in
6条回答
  •  温柔的废话
    2020-12-17 03:28

    I recommend downloading the source code for the build scripts of popular Java programs like limewire and follow their example. The end.

    ...Or you can do like I did:

    • I have done the JRE detection and download/install of redistributable if required with NSIS on Windows. Maybe an .msi is better than a installer.exe which NSIS creates. I believe msi are more like packages on mac so they allow proper updates. Maybe NSIS creates MSIs... not sure.
    • Mac is simply an Java App bundle and you specify the JRE and other Java info in the info.plist and you can optionally create a .pkg file to give the user an installer and bundle up in a dmg using the command line dmg programs.
    • I haven't done Linux and don't plan to... sorry :)

    All this was a fair chunk of work. I first did the Windows stuff then a couple years later did the Mac stuff.

    You can integrate all of this in NSIS build scripts and Ant. I can't remember why I didn't use install4j. Probably I was too cheap :)

提交回复
热议问题