简体   繁体   English

使用Java Web Start在Mac上启动SWT

[英]Launching SWT on Mac using Java Web Start

Goal: Launch SWT Web Start application on Mac using Java 7 目标:使用Java 7在Mac上启动SWT Web Start应用程序

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. 为了在Mac OS X上运行SWT RCP应用程序,有充分的文档证明,有必要将-XstartOnFirstThread作为Java虚拟机参数的一部分包括在内

Unfortunately, Java Web Start seems to be deleting this argument. 不幸的是,Java Web Start似乎正在删除该参数。 Looking at Java Web Start's detailed tracing logs: 查看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+"/> ...

So Web Start is successfully receiving the XstartOnFirstThread parameter. 因此,Web Start成功接收了XstartOnFirstThread参数。

and later 然后

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"]

Notice that startOnFirstThread is correctly identified, but then not passed along in the next processing stage. 请注意,startOnFirstThread已正确识别,但随后未传递到下一个处理阶段。 Perhaps it's not recognized as 'isSecure: true'? 也许它没有被识别为“ 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 correctly parses -XstartOnFirstThread and -Xms1024m but only chooses to pass on -Xms1024m and NOT -XstartOnFirstThread. Web Start正确解析-XstartOnFirstThread和-Xms1024m,但仅选择传递-Xms1024m而不是-XstartOnFirstThread。

In the same vein, if I execute ps aux | grep ms1024m 同样,如果我执行ps aux | grep ms1024m ps aux | grep ms1024m for the few seconds that Web Start begins to load the application, I get: 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

Again, Xms1024m is used, but not XstartOnFirstThread. 同样,使用Xms1024m,但不使用XstartOnFirstThread。

(Note a number of pieces of identifying information were removed from the logs posted here, but this should not affect the analysis). (请注意,许多标识信息已从此处发布的日志中删除,但这不应影响分析)。

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. 我还确认了将相关文件从服务器复制到本地计算机,并通过java -XstartOnFirstThread...运行应用程序没有问题。

How can I launch an SWT Web Start application on Mac using Java 7? 如何使用Java 7在Mac上启动SWT Web Start应用程序? How can I get startOnFirstThread to be successfully processed by Java 7? 如何获得startOnFirstThread以便由Java 7成功处理? Is there another way around the SWT Mac quagmire? SWT Mac泥潭有没有其他解决方法?

Mac OS X 10.9.2 Mac OS X 10.9.2

Java 1.7.0_60 Java 1.7.0_60

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 applet启动期间,“正在运行的JVM args与安全子集匹配”是什么意思?

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

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