Quantcast
Channel: Running SWT based, cross-platform jar properly on a Mac - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Running SWT based, cross-platform jar properly on a Mac

$
0
0

I have been working on a SWT-based project which is intended to be deployed as Java Web Start, and thus be used on multiple platforms.

So far I have managed to tackle the exporting problem that arises due to the system-specific libraries SWT depends on (see relevant thread). The resultant jar seems to work start fine on 32/64-bit linux and 64-bit windows, however execution fails on a Mac with the following output:

$ java -jar dist/test.jar Adding { file:/Volumes/LaCie/ChiBE_Local/swt/swt-cocoa-macosx-x86_64-3.6.1.jar } to the classpath***WARNING: Display must be created on main thread due to Cocoa restrictions.Exception in thread "main" java.lang.reflect.InvocationTargetException   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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)Caused by: java.lang.ExceptionInInitializerError   at org.eclipse.gef.tools.MarqueeSelectionTool.<init>(MarqueeSelectionTool.java:99)   at org.gvt.MarqueeZoomTool.<init>(MarqueeZoomTool.java:16)   at org.gvt.action.MarqueeZoomToolAction$1.<init>(MarqueeZoomToolAction.java:28)   at org.gvt.action.MarqueeZoomToolAction.createTool(MarqueeZoomToolAction.java:28)   at org.gvt.action.AbstractGEFToolAction.<init>(AbstractGEFToolAction.java:24)   at org.gvt.action.MarqueeZoomToolAction.<init>(MarqueeZoomToolAction.java:20)   at org.gvt.TopMenuBar.createBarMenu(TopMenuBar.java:113)   at org.gvt.ChisioMain.createMenuManager(ChisioMain.java:617)   at org.eclipse.jface.window.ApplicationWindow.addMenuBar(ApplicationWindow.java:235)   at org.gvt.ChisioMain.main(ChisioMain.java:149)   at org.gvt.RuntimeMain.main(RuntimeMain.java:14)   ... 5 moreCaused by: 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 org.eclipse.swt.widgets.Display$1.run(Unknown Source)   at org.eclipse.swt.graphics.Device.getDevice(Unknown Source)   at org.eclipse.swt.graphics.Resource.<init>(Unknown Source)   at org.eclipse.swt.graphics.Cursor.<init>(Unknown Source)   at org.eclipse.draw2d.Cursors.<clinit>(Cursors.java:170)   ... 16 more

I have checked a number of relevant threads: (Can't get SWT Display on Mac OS X, Problems With SWT on Mac) as well as the UI Thread entry on the SWT FAQ and tutorials such as Bringing your Java App to Mac and Deploying SWT applications on Mac OSX.

It's my understanding that the problem originates from thread handling on Mac OSX, and I should try to implement the JVM argument -XstartOnFirstThread at the execution. Is this right?

Assuming that my understanding of the problem is accurate, I am a bit confused as this software is intended to be cross-platform and run on javaws. Do I need to create an info.plist file, if so where in the package and how, otherwise how can I "conditionally" pass that argument to JVM at the time of execution?

Thanks in advance,


Viewing all articles
Browse latest Browse all 3

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>