File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error when using JDOM

 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The full code is


 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still produces the same error Jesper
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic