Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Wanted: Simple ant file for hello world
Wanted: Simple ant file for hello world [message #461920] Tue, 04 October 2005 16:32 Go to next message
Eclipse UserFriend
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 #462007 is a reply to message #461920] Wed, 05 October 2005 01:11 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
Siegfried Heintze wrote:
> 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?

For my projects I just use Eclipse to build it and do not use
ant. Does this book come with an example ant file? Maybe if you
post it here someone can tell you what it is doing wrong.

-Billy
Re: Wanted: Simple ant file for hello world [message #462049 is a reply to message #462007] Wed, 05 October 2005 05:28 Go to previous messageGo to next message
Eclipse UserFriend
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>
Re: Wanted: Simple ant file for hello world [message #462065 is a reply to message #462049] Wed, 05 October 2005 14:55 Go to previous message
Grzegorz Zieliñski is currently offline Grzegorz ZieliñskiFriend
Messages: 41
Registered: July 2009
Member
Hello Siegfried,

As far as I know, the filenames of *.jar archives containing libraries
have changed in Eclipse 3.1 - now they contain version number too.
So this might be the cause - try to play with build.xml setting.

Hope this would help you. :)

Grzegorz Zieliński
g_zielinski<at>intechion.pl
Previous Topic:Stupid FileDialog question
Next Topic:Help with no more handles error
Goto Forum:
  


Current Time: Sat Apr 20 04:09:00 GMT 2024

Powered by FUDForum. Page generated in 0.03698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top