如何在Mac 10及更高版本上分发Java应用程序7.0及更高版本? [英] How to distribute Java application 7.0 and above on Mac 10 and above?

查看:220
本文介绍了如何在Mac 10及更高版本上分发Java应用程序7.0及更高版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Mac上运行我的Java应用程序。我可以找到这个



我发布了da详细教程:
centerkey.com/mac/java



无论好坏, javapackager 捆绑JRE,生成的 .pkg 文件超过60MB。


I need to run my Java application on Mac. I could find this tutorial to use Xcode to bundle the application. The tutorial asks readers to have access to Jar Bundle application butI could not find it in the /Developer/Applications/Java Tools/ folder.

After that I came across this answer which seems is offering a good method to do it.

However, I am wondering if there is any better way to get the job done rather than the one mentioned there.

解决方案

The Mac OS X utilities Jar Bundler, Icon Composer, and PacakgeMaker are all deprecated. Even the various AppBundler projects out there seem destine to fade away.

The way forward looks to be javapackager, which is included in the JDK.

The -deploy -native pkg options will convert a Java application (Executable JAR) into a native macOS installer.

Example commands:

$ jar cmf MainClass.txt ShowTime.jar *.class
$ javapackager -deploy -native pkg -srcfiles ShowTime.jar \
   -appclass ShowTime -name ShowTime \
   -outdir deploy -outfile ShowTime -v

Output: deploy/bundles/ShowTime-1.0.pkg

I posted a detailed tutorial at:
centerkey.com/mac/java

For better or worse, javapackager bundles the JRE and the resulting .pkg file is over 60MB.

这篇关于如何在Mac 10及更高版本上分发Java应用程序7.0及更高版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆