How to run SWT project using Netbeans?
I get run time exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3236 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
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:123)
at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
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:126)
at swttest.Main.formLayout(Main.java:41)
at swttest.Main.main(Main.java:36)
Java Result: 1
thanks;
> for no particular reason, I use eclipse as well, but
> I feel more comfortable with netbeans
Reasonable enough reason!
> yes, I directed the project to the swt jars
You need to add the swt jar files to both the project build and project run/debug class path. Exactly how you do this depends on the type of project you've created. The simplest way to add them to the netbean lib directory. The best way is to create a ant script to do it.
> > yes, I directed the project to the swt jars
>
> You need to add the swt jar files to both the project
> build and project run/debug class path. Exactly how
> you do this depends on the type of project you've
> created. The simplest way to add them to the netbean
> lib directory. The best way is to create a ant
> script to do it.
Have you tried this specifically with SWT? Did it work?
UnsatisfiedLinkError is a native library error, not classpath error, not to mention it's very common when starting to work with SWT. I've never tried SWT with NetBeans, in fact I don't use NetBeans much at all, I use Eclipse, personal preference, I've tried NetBeans but I'm just more comfortable with Eclipse. Anyway, to get this to work you need to add this argument to the launch configuration:
-Djava.library.path=*path to the SWT dlls*
There should be 3 of them and you just have to put the path to that directory, not each individual DLL.
Being unfamiliar with NetBeans I can't tell you exactly how to do this, but I assume there is some sort of launch dialog where you can specify JVM arguments. Hopefully this helps.