swt and ant
- From: "foaud167" <f.mardini@xxxxxxxxx>
- Date: 9 Nov 2005 10:49:52 -0800
hi,
currently i run swt apps from eclipse's "run as swt application" but
now i want to run something from outside eclipse.
i just can't seem to get it to work
i am using ant and a simple hello world application, but i keep getting
the following error
Buildfile: build.xml
compile:
run:
[java] java.lang.NoClassDefFoundError: HelloWorld
[java] Exception in thread "main"
BUILD FAILED
following is the code and the ant file.
it runs using eclipse's run as ...
thaks a lot for your help
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
public class HelloWorld {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, World");
label.setBounds(shell.getClientArea());
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="GenericSwtApplication" default="run" basedir=".">
<property name = "main.class" value = ""/>
<path id = "project.class.path">
<pathelement path="${build}"/>
<fileset dir="c:\eclipse\plugins">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile">
<javac srcdir = "." destdir = ".">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name = "run" depends = "compile">
<java classname = "${main.class}" fork="true" failonerror = "true">
<jvmarg value = "-Djava.library.path=c:\eclipse\plugins"/>
<classpath refid="project.class.path"/>
</java>
</target>
</project>
.
- Prev by Date: Re: visual web based workflow designer using java
- Next by Date: Add ButtonGroup in Eclipse VE
- Previous by thread: visual web based workflow designer using java
- Next by thread: Add ButtonGroup in Eclipse VE
- Index(es):