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.

October 31, 2004. Eclipse, JFace, SWT. 18 Comments.

18 Comments

  1. vibhash replied:

    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

    November 18th, 2004 at 5:23 am. Permalink.

  2. Luis de la Rosa replied:

    vibhash,

    How are you starting up Eclipse? Are you using the ./eclipse script?

    November 19th, 2004 at 12:12 am. Permalink.

  3. sapbucket replied:

    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?

    November 28th, 2004 at 5:57 am. Permalink.

  4. Anonymous replied:

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

    eclipse 3.0.1, XP

    January 4th, 2005 at 5:32 pm. Permalink.

  5. Benjamin Booth replied:

    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!

    January 12th, 2005 at 4:27 pm. Permalink.

  6. Moment replied:

    That did the trick! thanks very much for the help :)

    February 21st, 2005 at 5:02 pm. Permalink.

  7. Pieter replied:

    Perfect! Saved me a lot of time! :-)

    March 5th, 2005 at 5:29 pm. Permalink.

  8. 彭悦 replied:

    merci beaucoup

    April 8th, 2005 at 11:53 am. Permalink.

  9. arn replied:

    how to install SWT and use it easyly?

    April 28th, 2005 at 10:43 am. Permalink.

  10. And replied:

    Thank you

    May 3rd, 2005 at 12:37 pm. Permalink.

  11. Shivkumar replied:

    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.

    June 29th, 2005 at 2:59 pm. Permalink.

  12. Austin Kenny replied:

    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

    July 19th, 2005 at 11:51 am. Permalink.

  13. Sail replied:

    thanks very much.

    August 24th, 2005 at 11:00 am. Permalink.

  14. Sail replied:

    thanks very much.

    August 24th, 2005 at 11:13 am. Permalink.

  15. Laura replied:

    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).

    September 5th, 2005 at 11:02 am. Permalink.

  16. Markus Sandy replied:

    This does not work for me on OSX (Tiger). I think there is another factor here as Laura suggests.

    October 23rd, 2005 at 5:13 pm. Permalink.

  17. Stanislav Vodetskyi replied:

    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.

    January 10th, 2008 at 5:10 am. Permalink.

  18. Kristina replied:

    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?

    January 22nd, 2008 at 6:02 pm. Permalink.

Leave a Reply