Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache Ant didn't include resource into my classpath?

 
Roger Lim
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

i have this package

view/MyFrame.java
view/res/home.gif

In MyFrame.java, 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
...
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>

<target name="run" depends="compile">
<java fork="true" classname="view.MyFrame">
<classpath>
<pathelement path="${targetdir}"/>
</classpath>
</java>
</target>

i did copy the resource to my targetdir during compilation. Anyone has any idea what is wrong? thank you!
[ September 22, 2007: Message edited by: Roger Lim ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic