What to do when you get an UnsatisifiedLinkError when running an SWT or JFace application

So you’re trying to run an SWT application (or JFace, since JFace relies on SWT) inside Eclipse and you get the dreaded UnsatisfiedLinkError. This usually appears as one of the following: Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-pi-carbon-3063 in java.library.path (Carbon on Mac OS X), Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-win32-3063 in java.library.path (Win32 on Windows), or Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3063 in java.library.path (GTK2 on Linux). Those are the UnsatisifiedLinkErrors for SWT in Eclipse 3.0.1.
For Eclipse 3.0, it would be swt-pi-carbon-3062, swt-win32-3062, and swt-pi-gtk3062 respectively.

Now there is an easy correction for this. Just go to “Run” | “Run…”, which brings up the “Run” dialog. Then navigate to the “Arguments” tab and in the “VM Arguments:” text box, enter (for Eclipse 3.0.1):

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.carbon_3.0.1/os/macosx/ppc (for Carbon on Mac OS X)

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.win32_3.0.1/os/win32/x86 (for Win32 on Windows) or

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.gtk_3.0.1/os/linux/x86 (for GTK2 on Linux).

For Eclipse 3.0, substitute 3.0.0 wherever you see 3.0.1.

18 Replies to “What to do when you get an UnsatisifiedLinkError when running an SWT or JFace application”

  1. hi friends ,
    i am new use of linux, i resently installed red hat linux 9.0, eclipes 3.0.1 and java 1.4.2 on my mechine, but i got following error while starting eclipes
    java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3063 in java.library.path
    plz resolve my problem, thax in advance….. with regards
    vibhash

  2. I had this same problem. I solved it using Luis de la Rosas’ suggestion. One thing I am curious about: do I now have to do this EVERYTIME I start a new SWT application?

  3. Thanks a lot, it takes me two minutes to resolve this kind of irritating pbm.

    eclipse 3.0.1, XP

  4. Hey just wanted to thank you publicly for this great workaround. I also wanted to add that Windows users whose Eclipse dir is under “Program Files” may need to surround their -D value with quotes as follows:

    -Djava.library.path=”C:/Program Files/Eclipse/3.0/eclipse/plugins/org.eclipse.swt.win32_3.0.0/os/win32/x86″

    Happy Coding!

  5. hello friends!

    I am a windows user. I am trying to build azureus on eclipse(eclipse-SDK-3.0.2-win32). I am finding a similar error while running –

    Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-carbon-3062 in java.library.path

    I put the following argument -Djava.library.path=
    “C:\Shiv\Tools\eclipse\plugins\org.eclipse.swt.win32_3.0.2\os\win32\x86”
    Which is the path of the folder that contains following 3 files on my machine –

    javaw.exe.manifest
    swt-awt-win32-3064.dll
    swt-win32-3064.dll

    But still the same error re-appears. Somebody please help me out.

    Thank you very much.

  6. Great help I am a linux user and I dont need the ” ” in the VM Arguments but now I have move to windows “NOT by choice”

    i was wondering what my problem was

    -Djava.library.path=”C:/Program Files/Eclipse/3.0/eclipse/plugins/org.eclipse.swt.win32_3.0.0/os/win32/x86″

    thanks Benjamin Booth

  7. If you are trying to run Azureus on windows you can run into this error:

    Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-carbon-3062 in java.library.path

    As is described a few posts higher (Posted by: Shivkumar | June 29, 2005).

    Though this errormessage looks very similar to the error described on this page, the underlying problem is completely different. It will occur even if you use the workaround described here or have the dll’s in a directory on your (windows) path.

    To fix this error, make sure you specify the swt.jar BEFORE the swt-pi-osx.jar in your classpath or don’t specify it at all during runtime (you need it @ compiletime if you don’t want any errors though).

  8. I’m now trying to use this solution on mac os x leopard and java6, but there is no org.eclipse.swt.carbon_3xx dir.

  9. I created a Java project in Eclipse referencing a DLL and everything ran properly. In Interface.java I declared the native functions, ie:
    public native int ced_open_file(String filename);
    ….

    static {
    System.loadLibrary(“libparser.dll”);
    }

    Test.java contains the main program.

    I moved the same files in a Plug-in project. I added libparser.dll to the root and added it to build.properties. I get the error:

    java.lang.UnsatisfiedLinkError: myplugin/Interface.open_file
    at myplugin.Interface.open_file(Ljava.lang.String;)I(Interface.java:???)
    at myplugin.Test.main(Test.java:29)

    I have also changed System.load to System.loadLibrary(exact path to dll) and added the path to the VM arguments using -Djava.library.path. I get the same error.

    Have any suggestions to why it works as a Java Project but not as a plug-in?

Comments are closed.