Hi,

I am a java newbie. I am getting the following error in eclipse.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-cocoa-3557 or swt-cocoa in swt.library.path, java.library.path or the jar file

I have the following jars in my library.
_swt-cocoa-32
_swt-cocoa-64
swt-cocoa-32
swt-cocoa-64
swt-gtk
swt-gtk-64
swt-win

Can anybody help me ? Is the information i have posted sufficient for finding the error ?

Thanks

Dani AI

Generated

The error means the JVM tried to load a native SWT library named swt-cocoa-3557 (or swt-cocoa) and could not find a matching native binary in the places the loader checks: the SWT jar, swt.library.path, or java.library.path. Given your list () the most likely problem is that multiple platform-specific SWT jars are present at runtime (your swt-win, swt-gtk*, swt-cocoa-32/64, etc.). SWT requires a single platform/arch build that matches the running JVM and OS — mixing them confuses the native loader.

Quick checks and fixes:

  • Confirm JVM OS/bitness. Run this small snippet to print the values the loader cares about:
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.arch"));
System.out.println(System.getProperty("sun.arch.data.model")); // "32" or "64"
  • Use exactly one SWT jar that matches those properties (mac + 64-bit JVM -> the 64-bit swt-cocoa jar). Remove all other swt jars from the project/runtime classpath.
  • If the SWT jar does not expose its native .jnilib/.dylib directly, set the native location: in Eclipse expand the SW T jar on the Build Path and set the "Native library location" to the folder containing the extracted libswt-cocoa*.jnilib/.dylib, or add a VM argument like -Djava.library.path=/path/to/native.

Extra tips: make sure SWT version matches your SWT Java wrapper (version mismatch can change the native name like swt-cocoa-3557), avoid renaming jars arbitrarily, and do a clean rebuild after fixing the classpath. ’s classpath note is relevant for Java classes, but this particular error is about native libraries; ’s pointer to Eclipse forum posts is also aligned with the above native-library fixes.

Recommended Answers

All 2 Replies

Maybe this Eclipse forum post will help, otherwise you are for "fun" ride on Google results like these

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.