[Eclipse Notes] Configure the SWT Development Environment

xiaoxiao2021-03-06  17

This article assumes that the reader uses the Windows operating system JDK 1.4, other platforms and JDK versions should also be eight or nine.

In order to compile and run the SWT program, we have two options: 1-use Eclipse SDK; 2-download separate SWT binary and source files.

With Eclipse SDK, we can find SWT binary files in its plugins directory, the usual directory name is: org.eclipse.swt.win32_xxxx, the suffix is ​​the version number, there is OS and WS two sub-directory, content in this directory The JNI library and swt.jar are SWT, respectively.

If you don't use Eclipse to develop, or you need SWT source files, you need to download a separate SWT binary and source file package, you can find it below:

Http://mirror.pacific.net.au/eclipse/eclipse/downloads/drops/R-3.0.1-200409161125/swt-3.0.1-win32.zip

This ZIP file is subsequently included in the JNi library (some dll) and swt.jar, and SWTSRC.zip, this SWTSRC is our SWT source file, including C and Java source code.

In order to run the SWT program, we need to compile our SWT code. This time you need to tell the compiler SWT.jar position; after the compilation is successful, we need to specify the classpath containing swt.jar, you need to tell Java.exe in the command line A parameter, that is java.library.path, looks probably this look:

Java -CP% SWT_HOME% / swt.jar simplestswt -djava.library.path =% SWT_HOME%

If you use the Eclipse SDK 3.1M5A or updated version, you can right click. Java file Select Run As -> SWT Application, no need to write as long parameters in the command.

What is interesting is, we can see the current SWT support platform in the SWT download page of Eclipse.org:

Windows 98 / ME / 2000 / XP Windows CE (ARM Pocketpc) Windows CE (ARM Pocketpc, J2ME Profile) Linux (x86 / motif) Linux (x86 / gtk 2) Linux (AMD 64 / GTK 2) Solaris 8 (SPARC / MOTIF Qnx (x86 / photon) AIX (PPC / Motif) HP-UX (HP9000 / Motif) Mac OSX (Mac / Carbon)

Oh, the platform supported is limited, but it is still quite too much.

转载请注明原文地址:https://www.9cbs.com/read-45205.html

New Post(0)