• 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

Error when using JDOM

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ant sample

codes

Hi everyone,
I was trying to compile the codes in the above link through Ant. I followed the steps as shown in the first URL.
Once I run the build file, I get the following error in the code:



Even when I try to compile it through ordinary javac method, it yells the same error. I have placed the jdom.jar in jdk\jre\lib. I think that is not the problem. What would be the problem?


I think this error is in actual code only. So I post this here instead of posting in ANT forum
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The full code is


 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sujai Kaarthik wrote:I have placed the jdom.jar in jdk\jre\lib. I think that is not the problem. What would be the problem?


Putting JAR files there is not a good idea. Just add the JAR file to your classpath, by setting the CLASSPATH environment variable appropriately or by using the -cp or -classpath command line switches with the javac / java commands. See How To Set The Classpath.
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It still produces the same error Jesper
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error message states that the class "JDOMUtils" can't be found. That makes sense, because it's not in any of the packages that get imported. You'll need to add an import statement for it.
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf for your reply..

But, the JDOMUtils class must be in the downloaded JAR, but that is not present there!!

what shall I do now?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is "the downloaded jar"? No class of that name exists in the JDOM API, so where did you see it being used?
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I actually tried to integrate JUnit with Ant. So, I googled and found a links that I have posted in my first post. The actual code, the build file and the JUnit test codes were all from that link. When I tried to compile those codes as said in that first link, the error message said me to include JDOM-b9 JAR.

After you replied to me, I guessed that JDOMUtils class must lie in JDOM-b9 JAR. So I explored through the JAR to find such a class (but in vein).

Actually I didn't saw any program using JDOMUtils. Its just a plain guess because of the word JDOM

I took that code out, and used the moneysample example from JUnit instead and made some alteration to the build file. Yes, I was successful in this attempt.

Ulf, by the way thank you very much for your help
 
reply
    Bookmark Topic Watch Topic
  • New Topic