使用Java Web Start在Mac上启动SWT(Launching SWT on Mac us

2019-11-03 06:44发布

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

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

不幸的是,Java Web Start的似乎要删除这个说法。 纵观Java Web Start的的详细的跟踪日志:

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参数。

然后

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
...

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

  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:真正的”?

...并最终我得到了可怕的:

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和NOT -XstartOnFirstThread。

本着同样的精神,如果我执行ps aux | grep ms1024m ps aux | grep ms1024m对于Web Start的开始加载应用程序中的几秒钟,我得到:

/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。

(注意一些识别信息从这里张贴日志被拆除,但是这不应该影响分析)。

我也证实,从服务器相关的文件复制到我的本地计算机,并通过运行应用程序java -XstartOnFirstThread...没有问题的作品。

我怎么能推出在Mac上使用Java 7的SWT Web Start应用程序? 我怎样才能startOnFirstThread由Java 7的成功处理? 有没有解决的SWT的Mac泥潭另一种方式?

的Mac OS X 10.9.2

的Java 1.7.0_60

Answer 1:

你有没有试图使该参数的信任呢? 我还没有尝试过。 但是,请在Java小程序的启动,什么是“运行的JVM ARGS符合安全子集”是什么意思?



文章来源: Launching SWT on Mac using Java Web Start