I have an app written in Java and would like to write an installer progra开发者_JAVA技巧m for it, that will work equally well on Windows XP/Vista/7, and on OSX.
This installer program will need to make sure that a JRE >= 1.5 is installed. The program itself will run in an environment without net access, so I cannot use Java Web Start.
Is there such an installer builder? Or should I use separate installer builders for Windows and for Mac?
Not as far as I know. Mac OSX developer tools come with an installer that can check for JRE versions. I use NSIS installer for windows but had to write my own registry searching and version checking (especially since I need 64 bit java if the computer is 64 bit since I use JOGL).
Is there an installer? No, since the two platforms are drastically different in how they execute compiled code. Nonetheless, you do have some options, most of which are explained quite nicely on this page.
- make an executable jar (perhaps with a tool like Java Launcher) -- downside is you can't easily test for the version of the JVM
- use Java Web Start -- clunky
- use a multi-platform Java wrapper like Launch4j -- maybe your best option here?
- use a cross-platform installer program like install4j -- but you'll still have different downloads for Mac & Windoze installations
Hope that helps get you started!
You could try BitRock InstallBuilder (disclaimer, I am one of the developers) as it meets your requirements: It generates multiplatform installers for Windows and OS X (among other platforms). It includes an action to autodetect Java in the target machine as well as other to create Java launchers. It also has 'Java bundles' that you can include in your installer so if no Java runtime is found, it will install it as part of the main installation
I also want to mention InstallBuilder is a commercial tool, so that may or may not work for you, but we offer free licenses for open source projects and discounts for small developer shops.
精彩评论