I just finished coding a new Java application, and I would like to export it to a format that can be read on both Windows and Mac (or, if needed, two separate formats). I tried right-clicking on my project and exporting to a runnable JAR file, choosing to extract the required libraries into the generated JAR.
Since I've never exported from Eclipse before (I'm used to Unity and, to a lesser extent, Visual Studio), I'm sure I did something wrong, as it would not open on either macOS Sierra or Windows 10. What did I do wrong? Thanks!
EDIT: Here's the output when I try to run java -jar
on the JAR (file name has been obfuscated):
***WARNING: Display must be created on main thread due to Cocoa restrictions.
Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4533)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.SWT.error(SWT.java:4419)
at org.eclipse.swt.widgets.Display.error(Display.java:1089)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:840)
at org.eclipse.swt.widgets.Display.create(Display.java:823)
at org.eclipse.swt.graphics.Device.<init>(Device.java:129)
at org.eclipse.swt.widgets.Display.<init>(Display.java:722)
at org.eclipse.swt.widgets.Display.<init>(Display.java:713)
at org.eclipse.swt.widgets.Display.getDefault(Display.java:1419)
at myJar.MainWindow.main(MainWindow.java:19)