简体   繁体   English

在Mac上没有JDK的情况下如何运行主jar?

[英]How can I run main jar without JDK on a Mac?

I've been using the discontinued BuildDesk to compile and bundle my Java desktop application but it forces user to use legacy Java in macOS. 我一直在使用已停产的BuildDesk来编译和捆绑我的Java桌面应用程序,但它迫使用户在macOS中使用旧版Java。 I would like users to use latest as some users feel queazy about the word legacy. 我希望用户使用最新的,因为有些用户对“遗留”一词感到奇怪。

I found a script to create an .app bundle. 我找到了创建.app捆绑包的脚本。 When I export the main jar from Netbeans (Run Target > Other Targets > package-for-store) and include the jar, libs and resources in the bundle, it runs OK but requires JDK to be installed, unlike the compiled app from BuildDesk. 当我从Netbeans导出主jar(运行目标>其他目标>打包存储)并将jar,库和资源包含在捆绑包中时,它运行良好,但需要安装JDK,这与BuildDesk编译的应用程序不同。

Is there a way to bundle the jar so user doesn't need to download a JDK? 有没有办法捆绑jar,使用户不需要下载JDK? I have found answers for Windows, not macOS. 我找到了Windows而不是macOS的答案。 Some say no need for JDK, just JRE but I cannot get app to run if I have only JRE on my Mac. 有人说不需要JDK,只需要JRE,但是如果我的Mac上只有JRE,我将无法运行应用程序。

Thanks. 谢谢。

this is apparenlty because of a bug in mac and java : https://bugs.openjdk.java.net/browse/JDK-7131356 由于Mac和Java中的错误,这很明显: https ://bugs.openjdk.java.net/browse/JDK-7131356

which leads java 1.6 (made by apple not oracle) to be required under any circustance of running a java app. 这导致在运行Java应用程序的任何情况下都需要Java 1.6(由Apple而非oracle制造)。

(even if the app is self-contained apparently) (即使该应用显然是独立的)

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

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