ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RogerL <>
Subject Ant didn't include image resource into classpath?
Date Sun, 23 Sep 2007 05:41:25 GMT

 hi guys,

i have this package


In, i try to load the image using
ImageIcon ic = new ImageIcon("view/res/home.gif");

using eclipse ide, everything works fine, but when i use ant script to do
the job, the image didn't appear.

my build xml
<project name="Test" default="compile">

    <property name="sourcedir" value="${basedir}/src"/>
    <property name="targetdir" value="${basedir}/bin"/>
    <property name="librarydir" value="${basedir}/lib"/>

    <path id="libraries">
        <fileset dir="${librarydir}">
            <include name="*.jar"/>

    <target name="clean">
        <delete dir="${targetdir}"/>
        <mkdir dir="${targetdir}"/>

    <target name="compile" depends="clean, copy-resources">
      <javac srcdir="${sourcedir}"
	<target name="copy-resources">
        <copy todir="${targetdir}">
            <fileset dir="${sourcedir}">
                <exclude name="**/*.java"/>
	<target name="run" depends="compile">
    <java fork="true" classname="view.MyFrame" classpathref="libraries">	
      <pathelement path="${targetdir}"/>


i did copy the resource to my targetdir during compilation. Anyone has any
idea what is wrong? thank you!
View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message