This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

JasperReport problem

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I have a problem in setting up jasperreport.

It is mentioned here that I have to put these files in my classpath.

  • dist/jasperreports-X.jar
  • lib/commons-*.jar (all the commons - except maybe for commons-logging)
  • lib/itext-X.jar
  • lib/jdt-compiler.jar


  • I've done that. However, instead of pointing my classpath to each of these files, I extracted them, put them into one folder, and have my classpath points to this folder.
    It works, as I can compile my project successfully.

    But I got the following errors when I try to run my program :



    Class org/apache/commons/digester/Digester not found, which is funny because if I import org.apache.commons.digester.Digester in my code, the compiler gives me no error.

    Any clues ? Any helps will be appreciated.

    This is my code :

     
    andree surya
    Greenhorn
    Posts: 29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Never mind. Mine works already .
    Instead of compiling the JRXML on the fly like the code above, I use a pre-compiled jasper template instead.
     
    andree surya
    Greenhorn
    Posts: 29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    No it's not working. I run my program and now the error message :

    Class not found. The same problem like the one I mentioned in the first post.
     
    andree surya
    Greenhorn
    Posts: 29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Now i set my classpath to point to each of the JAR files under jasperreport-xxx/lib (using batch script off course).
    No luck. Still the same error.

    Anyone please?
    Desperately need help.
     
    author
    Posts: 3281
    8
    Mac OS X Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You need the log4j.jar in your classpath (log4j-1.2.15.jar probably)
     
    andree surya
    Greenhorn
    Posts: 29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Martijn Verburg wrote:You need the log4j.jar in your classpath (log4j-1.2.15.jar probably)


    Hi Martijn, thanks for the reply. I include log4j-1.2.9.jar to the classpath, but it's not working either.
    The packages contained inside log4j.jar is com.apache.log4j, anyway.
    The one that is missing is com.apache.commons.logging.Log. It is contained within commons-logging, but it's also already in the classpath.

    Hm . . . . Any ideas?
     
    Martijn Verburg
    author
    Posts: 3281
    8
    Mac OS X Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The only thing that I can think of is that it's not picking up the commons logging in your CLASSPATH for some reason or you have multiple copies of commons-logging in the CLASSPATH
     
    andree surya
    Greenhorn
    Posts: 29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Martijn Verburg wrote:The only thing that I can think of is that it's not picking up the commons logging in your CLASSPATH for some reason or you have multiple copies of commons-logging in the CLASSPATH


    Hey you're right ! I have another jasperreports-xxx.jar in my JRE\ext\lib. I delete it, and now it works !
    Million Thanks, Martijn
     
    Martijn Verburg
    author
    Posts: 3281
    8
    Mac OS X Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You're welcome
     
    No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!