| <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <title>SWT Standalone Examples Setup</title> |
| </head> |
| <body> |
| |
| <h2>SWT standalone examples setup</h2> |
| |
| <h3>Importing example source</h3> |
| |
| <p> |
| *** In the following description, substitute the location in which you installed Eclipse for INSTALLDIR *** |
| </p> |
| |
| <p>Import the example code and all its required resources into your workspace:</p> |
| |
| <ol> |
| <li>Create a Java Project called "SWT Examples". |
| <li>Select the project "SWT Examples" in the Packages view. |
| <li>Select the <strong>File</strong> > <strong>Import</strong> menu, then select <strong>Zip File</strong> from the subsequent dialog and click <strong>Next</strong>. |
| <li>Locate the source zip file for the SWT examples. For example: |
| <ul> |
| <li><em>win32: </em><code>INSTALLDIR\eclipse\plugins\org.eclipse.sdk.examples.source_3.0.0\src\org.eclipse.swt.examples_3.0.0\swtexamplessrc.zip</code> |
| <li><em>*ix: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.sdk.examples.source_3.0.0/src/org.eclipse.swt.examples_3.0.0/swtexamplessrc.zip</code> |
| </ul> |
| <li>Click <strong>Finish</strong>. |
| <li>Select the <strong>File</strong> > <strong>Import</strong> menu, then select <strong>Zip File</strong> from the subsequent dialog and click <strong>Next</strong>. |
| <li>Locate the jar file for the SWT examples. For example: |
| <ul> |
| <li><em>win32: </em><code>INSTALLDIR\eclipse\plugins\org.eclipse.swt.examples_3.0.0\swtexamples.jar</code> |
| <li><em>*ix: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.examples_3.0.0/swtexamples.jar</code> |
| </ul> |
| <li>Expand the top level directory of the jar file (/), uncheck "META-INF", and click <strong>Finish</strong>. |
| <li>In the resulting "<em>Overwrite?</em>" prompter click <strong>No To All</strong> so that only non-class resources will be imported. |
| </ol> |
| |
| <p>Now you need to compile the SWT examples. In order to do this, you must add the SWT jar(s) to |
| the compile path:</p> |
| <ol> |
| <li>Select the project "SWT Examples" in the Packages view, and from its context menu select <strong>Properties</strong>. |
| <li>Select the <strong>Java Build Path</strong> page, and then select its <strong>Libraries</strong> tab. |
| <li>Click on the <strong>Add External JARs...</strong> button. |
| <li>Locate the swt jar for the platform on which you wish to run:<br> |
| <ul> |
| <li><em>win32: </em><code>INSTALLDIR\eclipse\plugins\org.eclipse.swt.win32_3.0.0\ws\win32\swt.jar</code> |
| <li><em>gtk: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_3.0.0/ws/gtk/swt.jar</code> |
| <li><em>motif: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_3.0.0/ws/motif/swt.jar</code> |
| <li><em>photon: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_3.0.0/ws/photon/swt.jar</code> |
| <li><em>macosx: </em><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.carbon_3.0.0/ws/carbon/swt.jar</code> |
| </ul> |
| <li>Click on OK. |
| </ol> |
| <p><strong>NOTE:</strong> For some platforms, such as GTK, more than one jar is required to run SWT (on |
| GTK there is a swt.jar and a swt-pi.jar and a swt-mozilla.jar file). In this case all of the required jars must |
| be added to the class path. This is done by repeating the steps above for each jar file. |
| All jar files are located in the same directory/folder.</p> |
| |
| <p>At this point your SWT examples should be compiled without any errors. Check the Tasks |
| view for errors. If you get an error like "<code>java.lang.Object</code> not found" it means |
| you have not configured a JRE. Go to the <strong>Window</strong> > <strong>Preferences</strong> dialog |
| and select the <strong>Java</strong> > <strong>Installed JREs</strong> preference page and ensure that a JRE is installed |
| and that the path to the JRE is correct.</p> |
| |
| <h3><a NAME="Run"></a>Running the Example</h3> |
| |
| <p>Now you have to configure Eclipse to run the example. This requires putting the SWT |
| JNI libraries on the library path so that the VM can find them: |
| |
| <ol> |
| <li>Open the Java perspective. |
| <li>In the Packages view, select the main class that you want to run. |
| For example, the main class for the Address Book example is |
| <code>org.eclipse.swt.examples.addressbook.AddressBook</code>. |
| <li>Select <strong>Run</strong> > <strong>Run...</strong> from the main menu. |
| <li>In the Launch Configurations dialog that appears, select <strong>Java Application</strong> and click |
| on the <strong>New</strong> button. |
| <li>Fill in the <strong>Name</strong>, <strong>Project</strong> and <strong>Main</strong> class fields according to the example that you wish to run. |
| <li>Select the <strong>Arguments</strong> tab. In the <strong>VM Arguments</strong> area specify the location of the SWT |
| library depending on your target platform as follows: |
| <ul> |
| <li><em>win32: </em><code>-Djava.library.path=INSTALLDIR\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86</code> |
| <li><em>linux gtk: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_3.0.0/os/linux/x86</code> |
| <li><em>linux motif: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_3.0.0/os/linux/x86</code> |
| <li><em>solaris motif: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_3.0.0/os/solaris/sparc</code> |
| <li><em>aix motif: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_3.0.0/os/aix/ppc</code> |
| <li><em>hpux motif: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_3.0.0/os/hpux/PA_RISC</code> |
| <li><em>photon qnx: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_3.0.0/os/qnx/x86</code> |
| <li><em>macosx: </em><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.carbon_3.0.0/os/macosx/ppc</code> |
| </ul> |
| <li>Click on the <strong>Run</strong> button. |
| </ol> |
| |
| |
| <h3>Examples Overview</h3> |
| <p> |
| Consult the documentation of each individual example for the name of |
| its main class and additional details. |
| The following examples are included in the <code>swtexamples.jar</code>: |
| </p> |
| <ul> |
| <li><a href="swt_addressbook_ex.html">Address Book</a> |
| <li><a href="swt_clipboard_ex.html">Clipboard</a> |
| <li><a href="../../org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html">Controls</a> |
| <li><a href="../../org.eclipse.swt.examples.controls/doc-html/swt_customcontrols_ex.html">Custom Controls</a> |
| <li><a href="swt_fileviewer_ex.html">File Viewer</a> |
| <li><a href="swt_helloworld_ex.html">Hello World [1-5]</a> |
| <li><a href="swt_hoverhelp_ex.html">Hover Help</a> |
| <li><a href="swt_imageanalyzer_ex.html">Image Analyzer</a> |
| <li><a href="swt_javaviewer_ex.html">Java Syntax Viewer</a> |
| <li><a href="../../org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html">Layouts</a> |
| <li><a href="swt_texteditor_ex.html">Text Editor</a> |
| </ul> |
| |
| <p><br><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation and others 2000, 2003. All Rights Reserved." BORDER=0 height=14 width=324></a> |
| </body> |
| </html> |