Reputation: 104
I have created a Java SWT software using eclipse.
I exported it to an executable jar and it works perfectly on my computer.
Whenever the jar is first used it is programmed to create an info.txt
file.
When I copy the jar to a different computer, it does create the info.txt
file but nothing else happens :(
No window is opened, no GUI appears.
Any ideas?
Upvotes: 1
Views: 258
Reputation: 328810
SWT is platform specific, just like Swing: You need a different version for Windows, Mac and Linux (and different versions for 32 and 64 bit versions of those).
Swing comes with your Java VM, so you never notice. With SWT, you must make this happen. See Create cross platform Java SWT Application
The other thing is that you need to make sure you can see exceptions when the application can't open a window. First, run your JAR from the command line instead of double-clicking. If you don't see an exception, make sure you don't just swallow them.
If you still don't see anything, wrap your main()
in a try {} catch (Throwable t) { t.printStackTrace(); }
Upvotes: 2