• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ant problem..need help

 
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ant 1.6.5

If I have an interface like below:


Then I want to pull values from Java code into Ant as parameter:


When I run the useconstant target, I got the following error:

Since I use the embedded Ant in the Eclipse 3.2, so all the neccesary jars should be included.

Need help on this.

Kind Regards,
Jiafan
 
author & internet detective
Posts: 41871
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


<loadproperties srcfile="classes/Constants.class">


It's having trouble finding this file. That's why you are getting an IOException. Try printing out the working directory from Ant and making sure classes/Constants.class is in it.
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, but that is not the point..
I am 100 percent sure the class file is in the right place..and I even explicitly deleted the class file for the trouble shooting reason..

If I delete the class file what I need, then I got a different exception telling me not even found the file..

So I guess what Ant1.6.5 thinks about is that the little ant cannot load my class file somehow..
(maybe I should try this on ant1.5, because this is an example on an Ant1.5 book)

Am I right on this?

Kind regards,
Jiafan
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestions?
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like the following errors if I specified a non-existance file.
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this a really hard question that nobody replies?
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it works for me using your code snippet.

So, I went to google.... "Unable to load file: java.io.IOException bcel"

The first hit I got said that error can be due to not having the bcel jar with your other ant jars (I've already got that installed, when I removed it I got an IOException like you got).

You don't indicate that you downloaded that and added it to your ant configuration in eclipsed. The comment in your code mentions bcel, maybe not obvious there's a library dependency.

From ant manual on Library Dependencies:

bcel.jar classfileset data type, JavaClassHelper used by the ClassConstants filter reader and optionally used by ejbjar for dependency determination http://jakarta.apache.org/bcel/



Does that help?
 
Jeanne Boyarsky
author & internet detective
Posts: 41871
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jiafan Zhou:
Is this a really hard question that nobody replies?


Please allow at least 24 hours for people to respond. JavaRanch is an international community so people sleep and work at different times.
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Carol,

Thanks for your help.

I think that Eclipse3.2 has already embedded the Ant 1.6.5 which has the ant-apache-bcel.jar in my project libraries..However and I still downloaded the bcel-5.2 from the Apache website and include the jar in my project..

still the same error.



Could you tell me what Ant version are you using?


Kind regards,
Jiafan
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:

Please allow at least 24 hours for people to respond. JavaRanch is an international community so people sleep and work at different times.



Sorry for my desire to know the answer..but if you noticed the initial date I posted this thread, it was 4 days ago..

Eventually I figured it out with Carol's help...so before I go any further into the solution I am going to share with others, I must pass my thanks to her.

Download the latest BCEL jars from the Jakarta website and include this jar in the Ant runtime configuration panel.
I got the last above error because I just simply import the jar to the project not the runtime..

For those who do not use Eclipse...maybe I guess just simply copy the jar into the Ant lib directory...

You see sometimes little Ant is complicated to work.

Regards,
Jiafan
 
Jiafan Zhou
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And the following is the output.



Regards,
Jiafan
 
Jeanne Boyarsky
author & internet detective
Posts: 41871
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jiafan Zhou:
Sorry for my desire to know the answer..but if you noticed the initial date I posted this thread, it was 4 days ago..


You are correct. I saw the two timestamps from 9/13 and didn't see the others.

Thanks for posting the solution so that others who see this thread in the future can benefit.
reply
    Bookmark Topic Watch Topic
  • New Topic