Problems with the tutorial HelloWorldSWT [message #755934] |
Thu, 10 November 2011 09:09 |
Virgilio Ravagli Messages: 12 Registered: November 2011 |
Junior Member |
|
|
After a while and some pain, I was able to make the tutorial HelloWorldSWT working on my PC, not only inside Eclipse (doing Run as-->Java app) but even as a standalone jarfile.
But I've got a lot of doubts about the "quality" of my solution.
I use Eclipse Indigo for Java Developer, with Window Builder, Swing and SWT Designer installed. The OS is Windows 7 Pro, both development and production.
I use ANT 1.8.1, inside Eclipse, to build the app.
So, this is my final build.xml (I also enclose it, in the case it's more readable):
<project name="HelloWorldSWT" basedir="." default="main">
<property environment="env" />
<property name="dest.dir" value="build" />
<property name="dest.dir.classes" value="${dest.dir}/classes" />
<property name="plugins.dir" value="${env.ECLIPSE_HOME}/plugins" />
<property name="repository.path" value="C:\ExeJar" />
<path id="build.class.path">
<fileset dir="${plugins.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${dest.dir}" />
</target>
<target name="prepare">
<mkdir dir="${dest.dir}" />
<mkdir dir="${dest.dir.classes}" />
</target>
<target name="main" depends="clean,prepare">
<javac srcdir="src" destdir="${dest.dir.classes}" includes="app/**">
<classpath refid="build.class.path" />
</javac>
<jar manifest="mainClass.txt" duplicate="preserve"
destfile="${dest.dir}/HelloWorldSWT.jar">
<zipfileset excludes="META-INF/**/*"
src="${plugins.dir}/org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar" />
<fileset dir="${dest.dir.classes}"/>
</jar>
<copy file="${dest.dir}/HelloWorldSWT.jar"
tofile="${repository.path}/HelloWorldSWT.jar" overwrite="true" />
</target>
</project>
It works, but I ask, is it the right way or is it a devious path ?
First of all, I'm not at ease with the inclusion of the plugin jar.
What do you suggest ?
thanks in advance,
Virgilio
-
Attachment: build.xml
(Size: 1.20KB, Downloaded 211 times)
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03998 seconds