Http://www.eclipse.org/swt/faq.php)
Translation: Frank (AT) zijinshi.cn)
Version: Version 0.9
The SWT FAQ
-
-
17. Q: Why is this error message: "Java. Lang. noclassdeffounderror: ORG/Eclipse/SWT/Internal/XXX/OS ."?
-
A: On some platforms, such as GTK, SWT is divided into several jar files. Therefore, make sure that all required jar files are listed in classpath. The required jar files are:
- SWT. Jar (all platforms)
- Swt-pi.jar (some platforms like GTK and carbon)
- Swt-mozilla.jar (Browser components for GTK and motif)
- Swt-gtk.jar (for Linux motif)
-
-
18. Q: Why is this error message: "Java. Lang. unsatisfiedlinkerror: No swt-win32-3232 in Java. Library. path ."?
-
A: You need to place the swt jni Library (which allows Java to use local components) where a Java VM can find it.
Swt jni libraries is included in the SWT download file.
You can use the following methods to let Java applications know the library path.
- Set the library path in the VM's home load parameters.
In launch configuration dialog, select the arguments page and enter-Djava. Library. Path = {runtime-library-path}Here, runtime-library-path is the path that contains the directory of the local code library.
This scheme means that the SWT library has to be manually added to each project using SWT.
- Set the library path in environment variables.
For Windows systems, add the runtime-library-path mentioned above in the PATH environment variable.
In win 9x, You need to modify the autoexec. BAT file.
In NT or 2 k machines, you canMy computer>Properties>Advanced>Environment VariablesEdit the variable.
In Linux/Unix systems, modify the LD_LIBRARY_PATH variable to include the runtime-library-path.
- Copy the SWT library to a directory that is already a Java library path. For example, the JRE/bin directory.
The disadvantage of this solution is that every time you upgrade eclipse, you have to remember to copy the local code library.
Since eclipse 3.1, the SWT plug-in has added the JNI library to SWT. jar. It supports osgi and eclipse RCP. If you use this plug-in, you must include the library in the path.
(To be continued ...)