This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SWT Standalone  RSS feed

 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new to Eclipse environment and I developed a small application using SWT. It works fine in the Eclipse IDE but when I export it as a JAR, it doesnt work at all. The problem is with the SWT Library, but I dont know how to fix it. How can I add the SWT Library into my jar file and get it work?

Thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add this line to your JAR file's MANIFEST.MF -


However, since SWT requires a platform-specific library to run you also need to provide this along with it. You can specify -Djava.library.path on the command-line, but this really stinks for a JAR - you just want to click on it and run.

To make this work on (at least on windows) you can put the .dll and the swt.jar in the same directory as your JAR, put into your JAR's MANIFEST.MF -


Another approach that would work on any platform would be to make a script that launches your application rather than launching from a JAR - .bat for windows and .sh for Unix/Linux/Mac
 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Nathan.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!