适用于Java 6和Java 7的Mac OS X JavaApplicationStub [英] Mac OS X JavaApplicationStub for Java 6 AND Java 7

查看:78
本文介绍了适用于Java 6和Java 7的Mac OS X JavaApplicationStub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发具有本机可执行文件的跨平台Java应用程序.对于Mac OS X,我使用 Jarbundler 作为ANT任务来创建应用程序包.

I am developing a cross platform Java application with native executables. For Mac OS X I use Jarbundler as an ANT task to create the App package.

现在,Oracle发布了Java 7和它自己的ANT任务" Appbundler ,我遇到了一个问题.

Now that Oracle released Java 7 and its own ANT task "Appbundler" I got a problem.

将本机Mac OS X JavaApplicationStub与Jarbundler一起使用仅适用于Apple Java 6,而将Oracle JavaApplicationStub与Appbundler一起使用仅适用于Java 7.

Using the native Mac OS X JavaApplicationStub with Jarbundler only works for Apple Java 6, and using the Oracle JavaApplicationStub with Appbundler only works for Java 7.

我确实非常了解其背景,但是我想知道是否有一个可用于Java 6和Java 7的JavaApplicationStub.至今没找到……

I do understand the background of this very well, but I was wondering whether there is a JavaApplicationStub available that works with both Java 6 and Java 7. I haven't found one so far...

而且顺便说一句:JavaApplicationStub是否必须是本机C/C ++/C#二进制文件?还是也可以是可执行的Shellscript?

更新:

shell脚本可以替代本机JavaApplicationStub.

A shell script is a possible alternative to a native JavaApplicationStub.

我扩展了 Ian Roberts基本shell脚本,并以.现在,它既支持Apple Java 6和Oracle Java 7,又支持应用程序捆绑包中Java属性的 Info.plist 样式(Oracle引入了新的属性密钥).随时使用它!

I extended Ian Roberts basic shell script and released it on GitHub as "universalJavaApplicationStub". It now supports both Apple Java 6 and Oracle Java 7 and also both Info.plist styles for Java properties in the application bundle (Oracle introduced new property keys). Feel free to use it!

推荐答案

bundle中的主要可执行文件可以是Shell脚本,因此您可以使用首先尝试/Library/Internet Plug-Ins/JavaAppletPlugin的脚本.plugin/Contents/Home/bin/java (java 7 JRE安装位置),如果未找到,则退回到/usr/bin/java .后者将运行已安装的最新JDK(6或7),如果根本找不到 JDK,则应该提示安装Java 6.

The main executable inside a bundle can be a shell script, so you could use a script that first tries /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java (the java 7 JRE install location), and falls back on /usr/bin/java if that is not found. The latter will run the most recent JDK that has been installed (6 or 7) and should prompt to install Java 6 if there is no JDK found at all.

这篇关于适用于Java 6和Java 7的Mac OS X JavaApplicationStub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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