Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you build an SWT application with Maven

Tags:

I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)     at java.lang.Runtime.loadLibrary0(Runtime.java:823)     at java.lang.System.loadLibrary(System.java:1030)     at org.eclipse.swt.internal.Library.loadLibrary(Library.java:100)     at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:19)     at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)     at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)     at org.eclipse.swt.widgets.Display.<clinit>(Display.java:112)     at wenzlick.test.swt.main.Main.main(Main.java:30) 

Has anyone successfully got a swt app to build and run using maven?

Edit: I did a little research and found the problem. look at my post below

like image 582
Dave Avatar asked Nov 15 '08 13:11

Dave


People also ask

What is SWT application?

The Standard Widget Toolkit (SWT) is a Java based user interface library for developing desktop application. SWT supports Windows, Linux and Mac OS X. It provides lots of standard widgets, e.g., buttons and text fields as well as the option to create custom widgets.

How Maven is useful in build an application?

Maven provides project information (log document, dependency list, unit test reports etc.) Maven is very helpful for a project while updating central repository of JARs and other dependencies. With the help of Maven we can build any number of projects into output types like the JAR, WAR etc without doing any scripting.

How does Maven build a project?

Maven will start building the project. We give maven two goals, first to clean the target directory (clean) and then package the project build output as jar (package). Packaged jar is available in consumerBanking\target folder as consumerBanking-1.0-SNAPSHOT.

What is the difference between SWT and Swing?

The primary design goals are high performance, native look and feel, and deep platform integration. Swing, on the other hand, is designed to allow for a highly customizable look and feel that is common across all platforms.


1 Answers

I have uploaded the win32/64 & osx artifacts of the latest SWT version (4.2.2) to a googlecode repository, you can find it here:

https://swt-repo.googlecode.com/svn/repo/

To use it just put the following in your pom.xml:

<repositories>     <repository>         <id>swt-repo</id>         <url>https://swt-repo.googlecode.com/svn/repo/</url>     </repository> </repositories> 

Then you can just reference the SWT dependency relevant to your platform. For example:

    <dependency>         <groupId>org.eclipse.swt</groupId>         <artifactId>org.eclipse.swt.win32.win32.x86</artifactId>         <version>4.2.2</version>     </dependency> 

For other platforms, just replace artifactId with the appropriate value:

  • org.eclipse.swt.win32.win32.x86
  • org.eclipse.swt.win32.win32.x86_64
  • org.eclipse.swt.cocoa.macosx
  • org.eclipse.swt.cocoa.macosx.x86_64

Artifacts for additional platforms and older versions are available as well, visit the repository link above to find them.

Happy coding!

like image 150
urish Avatar answered Oct 10 '22 08:10

urish