Hy there,
i developed an application that is to be started via javaws, the application itself is tested to run on linux(ubuntu 10.04 LTS), windows 7 and mac OS. It's using swt and runs on all those platforms without problems if started locally.
after some struggling the application now starts on the linux and windows machines with all architectures quite well, if it wasn't for the mac!
I know that to run an swt application under macOS one needs to give the java-vm the XstartOnFirstThread
and to do same with javaws the jnlp file needs the following ressource tag:
<resources os="Mac">
<j2se version="1.5+" javaws-vm-args="-XstartOnFirstThread" />
<nativelib href="swt-3.6.2-cocoa-macosx-x86_64.jar" />
<jar href="swt-3.6.2-cocoa-macosx-x86_64.jar" />
</resources>
as discussed in this question macOS may have problems with swt and the j2se="xy"
definition so i tried it with a specific one, none at all (not even the global one) and the "generic" one (eg: j2se="1.5+"
).
i suspect that the argument javaws-vm-args="-XstartOnFirstThread"
or java-vm-args="-XstartOnFirstThread"
(found this argument with and without the "ws" part on the internet and tried both) is not passed on by javaws because the jar itself is running quite perfectly when executed locally on the mac.
The actual problem now is that with every possible combination of argumemts the application always exits with the following exception:
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Display.error(Unknown Source)
at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
at org.eclipse.swt.widgets.Display.create(Unknown Source)
at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.getDefault(Unknown Source)
at foo.bar.WebStartRunnable.<init>(WebStartRunnable.java:85)
at foo.bar.WebStartRunnable.main(WebStartRunnable.java:155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1909)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1847)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1609)
at com.sun.javaws.Launcher.run(Launcher.java:138)
at java.lang.Thread.run(Thread.java:680)
Here are the specs again:
i hope someone had the same problem and was able to fix it, thx in advance for all answeres,
cheers stoppal
The JNLP file is invalid. Check it with JaNeLA & correct any results in red before wondering why it might be failing on this, that or the other system.