Java Reference
In-Depth Information
Figure 17.1 Running the SWT version of “Hello, world”
If you have followed our sage advice and downloaded the GTK
version of the Eclipse SDK, then you need to copy out the SWT JAR files.
There are two files in the GTK version, and just one in the Motif version. The
GTK version's files are swt.jar and swt-pi.jar . They are both in the
eclipse/plugins/org.eclipse.swt.gtk_2.1.2/ws/gtk directory. You
will need to have both of these JAR files on the classpath of any SWT
application you are compiling or running.
Remember that SWT is a JNI library. You must also have the native Linux
shared libraries. These need to be made available to the Java native loader. The
files you need are located in the eclipse/plugins/org.eclipse.swt.
gtk_2.1.2/os/linux/x86 directory. The .so files there must be available to
any running SWT application. There are a couple of ways to do this. First, as
described in Section 5.7, you can set the LD_LIBRARY_PATH environment
variable. You also can use the -D parameter for the runtime VM to set the
java.library.path property.
If you want to, you can copy these files out of the eclipse directory to
some other location and then erase the eclipse directory with the lovable old
standby, rm -rf eclipse .
Oh, by the way, once you have compiled the sample code above and set
your classpath and Java library path correctly, running the application produces
the window shown in Figure 17.1.
17.2.6.2
Before we launch into this discussion, we should point out that the Javadoc
documentation for all SWT packages is available as part of the Eclipse Platform
Anatomy of an SWT Application
Search WWH ::




Custom Search