1

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?

yaron1m
  • 104
  • 5
  • Two thoughts: 1) What are the versions of JRE on your computer and the other computer? 2) What are the permissions on the second computer? – Tim Biegeleisen May 29 '15 at 10:22
  • 1
    You can run the jar in a terminal or command prompt to see if it has any errors. Most probably you've referenced some resource file(s) using an absolute path. – Titus May 29 '15 at 10:23

1 Answers1

2

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(); }

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • +1 [This](http://stackoverflow.com/questions/23359351/build-one-jar-per-platform-for-multi-platform-swt-application) may also be helpful. – Baz May 29 '15 at 10:34