| Author |
Running SWT Applications Outside of Eclipse
|
Peter Sapl
Greenhorn
Joined: Nov 07, 2004
Posts: 2
|
|
I created a very, very simple SWT project in Eclipse. public class y { private org.eclipse.swt.widgets.Shell sShell = null; public y() { super(); } public static void main(String[] args) { System.setProperty("java.library.path", "C:\\programme\\java\\eclipse\\plugins\\org.eclipse.swt.win32_3.0.1\\os\\win32\\x86"); org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault(); y thisClass = new y(); thisClass.createSShell() ; thisClass.sShell.open(); while (!thisClass.sShell.isDisposed()) { if (!display.readAndDispatch()) display.sleep (); } display.dispose(); } private void createSShell() { sShell = new org.eclipse.swt.widgets.Shell(); sShell.setSize(new org.eclipse.swt.graphics.Point(300,200)); sShell.setText("Shell"); } } This project only shows an empty window. Without setting (Arguments->VM Arguments) for the correct SWT library path in the configuration section of Eclipse (Djava.library.path="C:\programme\java\eclipse\plugins\org.eclipse.swt.win32_3.0.1\os\win32\x86") the project works because of setting this in the first line of the main method. Afterwards I created a Jar-File which includes the above mentioned class and a manifest-file containing the following: Manifest-Version: 1.0 Main-Class: y java -classpath .;%classpath%;C:\java\x\test1.jar -Djava.library.path="C:\Programme\Java\eclipse\plugins\org.eclipse.swt.win32_3.0.1\os\win32\x86" -jar test1.jar -> Error: Exception in thread �main� java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Display at y.main(y.java:34) java -classpath .;%classpath%;C:\java\x\test1.jar -Djava.library.path="C:\Programme\Java\eclipse\plugins\org.eclipse.swt.win32_3.0.1\os\win32\x86" y -> that�s ok Why does �java� not find the �org/eclipse/swt/widgets/Display�-class although in the classpath the right path to �swt.jar� is set, when I use a jar-file?
|
 |
 |
|
|
subject: Running SWT Applications Outside of Eclipse
|
|
|