简体   繁体   English

Mac / Windows Java应用程序应使用哪种打包工具?

[英]What packaging tool should I use for a Mac/Windows Java app?

I have a Java desktop app that runs on both the MacOS and Windows. 我有一个可同时在MacOS和Windows上运行的Java桌面应用程序。

I understand that I cannot have one distribution for each, which is not a requirement. 我知道我不能为每个分配一个,这不是必需的。

I need to know what tool or tools is best to use when delivering a Java app for each. 我需要知道为每个工具交付Java应用程序时最好使用哪种工具。

The tool should install prerequisites (in this case, Java and some JARs) and look native to the respective operating system. 该工具应安装先决条件(在本例中为Java和某些JAR),并看起来对相应的操作系统是本机的。

As for OS X's java situation: 至于OS X的Java情况:

  1. Currently, JDK 6 is bundled in the OS. 当前,JDK 6捆绑在操作系统中。
  2. Presumably, the next version of the OS will still include JDK 6. 据推测,该操作系统的下一版本仍将包括JDK 6。
  3. It's publicly stated that the OS will have a well-defined place to install multiple copies of Java runtimes, a public interface choosing which of the Java version, etc. See here . 公开声明,该操作系统将有一个定义明确的位置来安装Java运行时的多个副本,一个公共接口选择哪个Java版本,等等。请参见此处
  4. Apple started contributing back its own code to the open JDK community, so JDK 7 should be available as a separate download, see here . Apple开始向开放的JDK社区贡献自己的代码,因此JDK 7应该作为单独的下载提供,请参见此处
  5. So, you're not expected to include Java runtime itself into your Java app even then. 因此,即使那样,您也不希望将Java运行时本身包含在Java应用程序中。 You're not supposed to install Java in a ramdom place on a filesystem, for example. 例如,您不应该将Java安装在文件系统上的任意位置。

As for how you should deploy java apps on OS X: 至于如何在OS X上部署Java应用程序:

  1. Double-clicking jar just works. 双击jar即可。
  2. However, that won't be pretty, because you would only have a generic Java icon in the Dock. 但是,这不会很漂亮,因为Dock中只会有一个通用的Java图标。 You don't want that. 你不要那样
  3. You should use Jar Bundler to make it an honest OS X app. 您应该使用Jar Bundler使其成为一个诚实的OS X应用程序。 On Mac, it comes with XCode. 在Mac上,它带有XCode。 See the documentation here. 请参阅此处的文档 You can do that on a non-Mac machine too, using this open-source project . 您也可以使用此开源项目在非Mac机器上执行此操作

On Windows, I would recommend either JSmooth or WinRun4J . 在Windows上,我建议使用JSmoothWinRun4J

On a Mac, the situation is a bit more complex (as the comments point out), but just distributing an executable JAR is probably good enough for now. 在Mac上,情况要复杂一些(如注释所指出的那样),但是就目前而言,分发可执行的JAR可能就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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