Wanted: Simple ant file for hello world [message #461920] |
Tue, 04 October 2005 16:32 |
Eclipse User |
|
|
|
Originally posted by: siegfried.heintze.com
I'm having trouble making the build.xml file work. I downloaded it from the
"Definitive Guide for SWT and JFace". It is for the simple "Hello World". I
heard that things have changed recently. Is there a sample build.xml for a
"hello world" program for the recent version of Eclipse and SWT?
Thanks,
Siegfried
|
|
|
|
Re: Wanted: Simple ant file for hello world [message #462049 is a reply to message #462007] |
Wed, 05 October 2005 05:28 |
Eclipse User |
|
|
|
Originally posted by: siegfried.heintze.com
Here are the files. According to someone's (Billy's?) comments, java files
are not stored in such deep directories any more?
Thanks,
Siegfried
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=".">
<description>
Generic SWT Application build and execution file
</description>
<property name="main.class" value=""/>
<property name="src" location="."/>
<property name="build" location="."/>
<!-- Update location to match your eclipse home directory -->
<property name="ecl.home" location="c:\eclipse"/>
<!-- Update value to match your windowing system (win32, gtk, motif,
etc.) -->
<property name="win.sys" value="win32"/>
<!-- Update value to match your os (win32, linux, etc.) -->
<property name="os.sys" value="win32"/>
<!-- Update value to match your architecture -->
<property name="arch" value="x86"/>
<!-- Update value to match your SWT version -->
<property name="swt.ver" value="3.0.0"/>
<!-- Do not edit below this line -->
<property name="swt.subdir"
location="${ecl.home}/plugins/org.eclipse.swt.${win.sys}_${swt.ver} "/>
<property name="swt.jar.lib" location="${swt.subdir}/ws/${win.sys}"/>
<property name="swt.jni.lib"
location="${swt.subdir}/os/${os.sys}/${arch}"/>
<path id="project.class.path">
<pathelement path="${build}"/>
<fileset dir="${swt.jar.lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile">
<javac srcdir="${src}" destdir="${build}">
<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=${swt.jni.lib}"/>
<classpath refid="project.class.path"/>
</java>
</target>
</project>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03698 seconds