Could someone help me ? I know I am close to find the solution, but as I am a newbie to both Java and Eclipse I think I am running in circles around the answer.
I am using Eclipse 2.1.2 on WinXP (couldn't make the 3.0M7 work with SWT-Designer free edition, but that's another problem...)
I can design the widgets and generate code, but I can't make it running outside the design page, i.e. using the "light switch" I can see the shell and associated widgets running, but if i try to do the following:
Run... (by hitting the "running man" icon) I get the following error message:
java.lang.NoClassDefFoundError: de
Exception in thread "main"
This error message comes after launching the JVM.
I've learned in the "Java Tutorial Help file" that this message, in their own words, means the following:
" Error Explanation
If you receive this error, java cannot find your bytecode file, HelloWorldApp.class."
The Java source file is simple as that (just a lousy shell and a simple button code generated by SWT-Designer):
- Code: Select all
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
/* * Created on 16/03/2004 */
/** * @author William Boger */
public class It_Works_Main {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell();
shell.setLayout(new GridLayout());
shell.setText("SWT Application");
{
final Button button = new Button(shell, SWT.NONE);
button.setText("button");
}
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
In the workspace I created the project named "It_Works" (although it doesn't ... ), with the files It_Works_Main.java on the "src" sub-folder, whereas It_Works_Main.class is on the "bin" sub-folder.
The ".classpath" file is under {EclipseInstallDirectory}\workspace\It_Works and has the following contents:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.2/boot.jar"/>
<classpathentry exported="true" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.1.1/runtime.jar"/>
<classpathentry exported="true" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_2.1.2/ws/win32/swt.jar"/>
<classpathentry exported="true" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jface_2.1.1/jface.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
And Yes I have checked the following checkboxes on the "Run..." dialog:
(V) Using default working directory (in Arguments tab)
(V) Use default classpath (in Classpath tab)
(V) Use default Source path look up path (in Source tab)
So what could be going wrong ? Could anyone give me a hint ?
Thanks in advance.