简体   繁体   中英

Mac OS java version problem for jar files

我已经开发了一个用于Windows的setup.exe,具有自动检测JRE版本,自动安装所需的JRE版本,Windows启动等自动启动等功能。我从jar文件制作了这个exe文件(jar文件没有上述功能。稍后在将JAR转换为EXE时添加。现在我想知道我是否能以某种方式将exe转换为DMG,APP或JAR,或者我只能在我的JAR文件中添加上述功能。)默认情况下Mac附带Java版本5和我的应用程序需要运行最低Java版本6

The normal way to distribute a Java application on a Mac is different than on Windows. You don't need a native binary to run a Java application on Mac because you can bundle it into an application (.app) file.

JarBundler, which is part of the Xcode Deveoper Tools, helps you insert your JAR file into a new .app file. You'll also specify your icon at this stage and the main class.

The app file is really just a folder. You can open the .app file as a folder by option-clicking on the application file and choosing "Show Package Contents" in the pop-up menu. Sometimes you may need to tweak the Info.plist file in the application, as there are a lot of options. There is complete documentation about the Info.plist file on the apple's developer website.

Once you have your application, you can bundle that up into a Package using PackageMaker, also part of the Xcode Developer Tools.

Further, you can bundle the package into a disk image (DMG) using DiskUtility, which you'll find in the Utilities folder.

Regarding Java versions, prior to Snow Leopard, Java 6 was only available for Intel Macs. If you require Java 6, you'll need to require that they have an Intel Mac with the latest updates or have Snow Leopard. Alternatively, you could package SoyLatte into your app to replace the native Java runtime. You'd basically be distributing a 32-bit version of Java 6 with your app.

Java 1.6 is not released for all macs. Mine for one does not have it there is nothing you do about it.

As for creating a dmg. In the mac os x install cd is a package called developer tools. Which includes an application called Jar Bundler that allows you to wrap jar's in to apple's .app files(exe's for mac). As for a dmg image you can create it from command line or from ant target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM