使用 Java Web Start 在 Mac 上启动 SWT [英] Launching SWT on Mac using Java Web Start

查看:35
本文介绍了使用 Java Web Start 在 Mac 上启动 SWT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:使用 Java 7 在 Mac 上启动 SWT Web Start 应用程序

Goal: Launch SWT Web Start application on Mac using Java 7

为了在 Mac OS X 上运行 SWT RCP 应用程序,有据可查,包括 -XstartOnFirstThread 作为 Java 虚拟机参数的一部分.

In order to run an SWT RCP application on Mac OS X, it is well documented that it is necessary to include -XstartOnFirstThread as part of the Java Virtual Machine arguments.

不幸的是,Java Web Start 似乎正在删除此参数.查看 Java Web Start 的详细跟踪日志:

Unfortunately, Java Web Start seems to be deleting this argument. Looking at Java Web Start’s detailed tracing logs:

temp: returning LaunchDesc from XMLFormat.parse():

<jnlp spec="1.0+" codebase="..." href="...">
  <information> ...

  <resources>
    <java java-vm-args="-XstartOnFirstThread -Xms1024m" version="1.6+"/> ...

所以 Web Start 成功接收到 XstartOnFirstThread 参数.

So Web Start is successfully receiving the XstartOnFirstThread parameter.

以后

basic: Launching new JRE version: JREInfo for index 0:
    platform is: 1.7
    product is: 1.7.0_60
    location is: http://java.sun.com/products/autodl/j2se
    path is: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
    args is: 
    native platform is: Mac OS X, x86_64 [ x86_64, 64bit ]
    JavaFX runtime is: JavaFX 2.2.60 found at /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
    enabled is: true
    registered is: true
    system is: true

basic:   jvmParams: [JVMParameters: isSecure: false, args: -XstartOnFirstThread -Xms1024m ...]
basic: cmd 0 : /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
basic: cmd 1 : -Xms1024m
...
basic: cmd 12 : -Xbootclasspath/a:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/javaws.jar:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy.jar:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/plugin.jar
basic: cmd 13 : -classpath
basic: cmd 14 : /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy.jar
basic: cmd 15 : -Djnlpx.vmargs="-Xms1024m ..."
basic: cmd 16 : -Xdock:icon=/Users/kutnic/Library/Application Support/Oracle/Java/Deployment/cache/6.0/8/b871708-57c4f462.icns
...
basic: cmd 18 : -Djnlpx.jvm=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
basic: cmd 19 : -Djnlpx.splashport=-1
basic: cmd 20 : -Djnlpx.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
basic: cmd 21 : -Djnlpx.remove=false
basic: cmd 22 : -Djnlpx.offline=false
basic: cmd 23 : -Djnlpx.relaunch=true
basic: cmd 24 : -Djnlpx.session.data=/var/folders/bg/v8l2x6vn7xj1swx_0ksv7rcddzd2cb/T/session4911958714097309497
basic: cmd 25 : -Djnlpx.heapsize=NULL,NULL
basic: cmd 26 : -Djava.security.policy=file:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/javaws.policy
basic: cmd 27 : -DtrustProxy=true
basic: cmd 28 : -Xverify:remote
basic: cmd 29 : -Dsun.awt.warmup=true
basic: cmd 30 : com.sun.javaws.Main
...

同样,在日志的其他地方:

Similarly, elsewhere in the log:

  Selected JVMParam: [JVMParameters: isSecure: false, args: -XstartOnFirstThread -Xms1024m -Djnlp.serverIP=... -Djnlp.eclipse.product=... -Djnlp.debugLevel=1]
  Running  JVMParam: [JVMParameters: isSecure: true, args: "-Xms1024m -Djnlp.serverIP=... -Djnlp.eclipse.product=... -Djnlp.debugLevel=1"]

注意 startOnFirstThread 被正确识别,但没有在下一个处理阶段传递.也许它不被识别为isSecure: true"?

Notice that startOnFirstThread is correctly identified, but then not passed along in the next processing stage. Perhaps it's not recognized as 'isSecure: true'?

...最后我感到害怕:

... and in the end I get the dreaded:

OS X Detected...
***WARNING: Display must be created on main thread due to Cocoa restrictions.
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:4361)

Web Start 正确解析 -XstartOnFirstThread 和 -Xms1024m,但只选择传递 -Xms1024m 而不是 -XstartOnFirstThread.

Web Start correctly parses -XstartOnFirstThread and -Xms1024m but only chooses to pass on -Xms1024m and NOT -XstartOnFirstThread.

同样,如果我执行 ps aux |grep ms1024m 在 Web Start 开始加载应用程序的几秒钟内,我得到:

In the same vein, if I execute ps aux | grep ms1024m for the few seconds that Web Start begins to load the application, I get:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Xms1024m
-D... -Djnlp.osgi.instance.area=@none -Djnlp.osgi.configuration.area=@none -Djnlp.eclipse.product=... -Djnlp.javaws.cfg.jauthenticator=true -Djnlp.java.util.Arrays.useLegacyMergeSort=true -Djnlp.debugLevel=1 -Xbootclasspath/a:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/javaws.jar:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy.jar:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/plugin.jar
-classpath /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy.jar
-Djnlpx.vmargs="-Xms1024m -Djnlp.serverIP=... -Djnlp.osgi.instance.area=@none -Djnlp.osgi.configuration.area=@none -Djnlp.eclipse.product=... -Djnlp.javaws.cfg.jauthenticator=true -Djnlp.java.util.Arrays.useLegacyMergeSort=true -Djnlp.debugLevel=1" -Xdock:icon=/Users/.../Library/Application Support/Oracle/Java/Deployment/cache/6.0/8/b871708-6a8509fb.icns
-Xdock:name=... -Djnlpx.jvm=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
-Djnlpx.splashport=-1 -Djnlpx.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
-Djnlpx.remove=false -Djnlpx.offline=false -Djnlpx.relaunch=true -Djnlpx.session.data=/var/folders/bg/v8l2x6vn7xj1swx_0ksv7rcddzd2cb/T/session689216052548979970
-Djnlpx.heapsize=NULL,NULL -Djava.security.policy=file:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/javaws.policy
-DtrustProxy=true -Xverify:remote -Dsun.awt.warmup=true com.sun.javaws.Main ://.../webstart.jnlp

再次使用 Xms1024m,但不使用 XstartOnFirstThread.

Again, Xms1024m is used, but not XstartOnFirstThread.

(请注意,从此处发布的日志中删除了一些识别信息,但这不应影响分析).

(Note a number of pieces of identifying information were removed from the logs posted here, but this should not affect the analysis).

我还确认将相关文件从服务器复制到我的本地计算机并通过 java -XstartOnFirstThread... 运行应用程序没有问题.

I have also confirmed that copying the relevant files from the server to my local computer and running the application via java -XstartOnFirstThread... works without a problem.

如何在 Mac 上使用 Java 7 启动 SWT Web Start 应用程序?如何让 startOnFirstThread 被 Java 7 成功处理?是否有另一种方法可以解决 SWT Mac 的泥潭?

How can I launch an SWT Web Start application on Mac using Java 7? How can I get startOnFirstThread to be successfully processed by Java 7? Is there another way around the SWT Mac quagmire?

Mac OS X 10.9.2

Mac OS X 10.9.2

Java 1.7.0_60

Java 1.7.0_60

推荐答案

您是否尝试使该参数成为可信赖的参数?我没试过.但请检查 Java 小程序期间启动,什么是运行 JVM 参数匹配安全子集"?是什么意思?

Have you tried to make that parameter a trusted one? I have not tried it. But please check During Java applet startup, what does "Running JVM args match the secure subset" mean?

这篇关于使用 Java Web Start 在 Mac 上启动 SWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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