File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Jasper Reports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Jasper Reports" Watch "Jasper Reports" New topic
Author

Jasper Reports

Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
hi guys i am newbie to jasper reports

i want to create a simple hello world xls report from java

i would like to tell you what i know about jasper reports correct me if am wrong

to create a jasper report
1) create a jrxml template
2) create a java program to convert jrxml -> jasper -> jprint->xls

below is the code which i am using






i am getting the below error when i am compiling the code

javac FirstReportCompile.java
FirstReportCompile.java:4: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.JRException;
^
FirstReportCompile.java:5: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.JasperCompileManager;
^
FirstReportCompile.java:14: cannot find symbol
symbol : variable JasperCompileManager
location: class FirstReportCompile
JasperCompileManager.compileReportToFile(
^
FirstReportCompile.java:18: cannot find symbol
symbol : class JRException
location: class FirstReportCompile
catch (JRException e)
^
4 errors

i have set path as
C:\jasperreports-4.0.0\lib and also the default jdk\bin path
i have also tried setting the path of C:\jasperreports-4.0.0\src
but even that's not working please help me out
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You need to set the jasperreports jar file to be in your CLASSPATH.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
thanks for your reply i did that now i am getting the following error


C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRFillCrosstab.java:
766: cannot find symbol
symbol : class Dataset
location: class net.sf.jasperreports.engine.fill.JRFillCrosstab.JRFillCrosstabDa
taset
protected Dataset getCustomDataset()
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRFillDataset.java:7
9: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.fill.JRFillDataset
private static final Log log = LogFactory.getLog(JRFillDataset.class);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRFillDatasetRun.jav
a:52: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.fill.JRFillDatasetRun
private static final Log log = LogFactory.getLog(JRFillDatasetRun.class)
;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRFillReportTemplate
.java:52: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.fill.JRFillReportTemplate
private static final Log log = LogFactory.getLog(JRFillReportTemplate.cl
ass);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\crosstabs\design\JRDesignCrossta
b.java:112: cannot find symbol
symbol : class SequencedHashMap
location: class net.sf.jasperreports.crosstabs.design.JRDesignCrosstab
protected SequencedHashMap variablesList;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRFillSubreport.java
:78: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.fill.JRFillSubreport
private static final Log log = LogFactory.getLog(JRFillSubreport.class);

^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\util\JRSingletonCache.jav
a:30: package org.apache.commons.collections does not exist
import org.apache.commons.collections.ReferenceMap;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\util\JRStyledTextParser.j
ava:70: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.util.JRStyledTextParser
private static final Log log = LogFactory.getLog(JRStyledTextParser.clas
s);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRVirtualizationCont
ext.java:49: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.fill.JRVirtualizationContext
private static final Log log = LogFactory.getLog(JRVirtualizationContext
.class);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRVirtualizationCont
ext.java:51: cannot find symbol
symbol : class ReferenceMap
location: class net.sf.jasperreports.engine.fill.JRVirtualizationContext
private static final ReferenceMap contexts = new ReferenceMap(ReferenceM
ap.WEAK, ReferenceMap.WEAK);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\util\JRSingletonCache.jav
a:43: cannot find symbol
symbol : class ReferenceMap
location: class net.sf.jasperreports.engine.util.JRSingletonCache
private final ReferenceMap cache;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\design\JRAbstractJavaComp
iler.java:39: package org.apache.commons.collections does not exist
import org.apache.commons.collections.ReferenceMap;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\design\JRJdk13Compiler.ja
va:35: package org.apache.commons.logging does not exist
import org.apache.commons.logging.Log;
.
.
.
.
.
.
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:36: package org.apache.commons.collections does not exist
import org.apache.commons.collections.ReferenceMap;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:37: package org.apache.commons.logging does not exist
import org.apache.commons.logging.Log;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:38: package org.apache.commons.logging does not exist
import org.apache.commons.logging.LogFactory;
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:54: cannot find symbol
symbol : class Log
location: class net.sf.jasperreports.engine.component.ComponentsEnvironment
private static final Log log = LogFactory.getLog(ComponentsEnvironment.c
lass);
^
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:56: cannot find symbol
symbol : class ReferenceMap
location: class net.sf.jasperreports.engine.component.ComponentsEnvironment
private static final ReferenceMap cache = new ReferenceMap(
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
JasperReports probably consists of quite a few jar files - they all need to be in the classpath.


Ping & DNS - updated with new look and Ping home screen widget
Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\component\ComponentsEnvir
onment.java:38: package org.apache.commons.logging does not exist
import org.apache.commons.logging.LogFactory;

in this error it is not able to find package org.apache.commons.logging does not exist
but in jasper reports source there is no such package so how should i find this package
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

How are you building this? Maven? Ant? or a shell/batch script?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
JasperReports 3.7.6 consists of 48 jar files, including Apache Commons Logging; maybe you download just the JasperReports jar file? You need them all; they're in the "lib" folder of the JasperReports project download.
Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
this is how i am doing it
1) i created a jrxml file in that the code i have specified below in that i want to display hello world


then i am compling it with javac FirstReportCompile.java


then i get those errors
if am missing any steps please let me know
Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
i am using jasperreports-4.0.0
and there are 77 files in it, files are sorry for showing you the whole list
there is a common-logging.jar file but not any an ant common logging jar file



antlr-2.7.5-LICENSE.txt
ant-1.7.1.jar
antlr-2.7.5.jar
barbecue-1.5-beta1-LICENSE.txt
barbecue-1.5-beta1.jar
barcode4j-2.0-LICENSE.txt
barcode4j-2.0-NOTICE.txt
barcode4j-2.0.jar
batik-anim.jar
batik-awt-util.jar
batik-bridge.jar
batik-css.jar
batik-dom.jar
batik-ext.jar
batik-gvt.jar
batik-LICENSE.txt
batik-parser.jar
batik-script.jar
batik-svg-dom.jar
batik-svggen.jar
batik-util.jar
batik-xml.jar
bcel-5.2-LICENSE.txt
bcel-5.2-NOTICE.txt
bcel-5.2.jar
bsh-2.0b4-LICENSE.txt
bsh-2.0b4.jar
commons-beanutils-1.8.0.jar
commons-collections-2.1.1.jar
commons-digester-1.7.jar
commons-javaflow-20060411.jar
commons-LICENSE.txt
commons-logging-1.0.4.jar
commons-NOTICE.txt
groovy-all-1.7.5-LICENSE.txt
groovy-all-1.7.5.jar
hibernate3-LICENSE.txt
hibernate3.jar
hsqldb-1.8.0-10-LICENSE.txt
hsqldb-1.8.0-10.jar
iText-2.1.7-LICENSE.txt
iText-2.1.7.jar
jaxen-1.1.1-LICENSE.txt
jaxen-1.1.1.jar
jcommon-1.0.15-LICENSE.txt
jcommon-1.0.15.jar
jdt-compiler-3.1.1-LICENSE.html
jdt-compiler-3.1.1.jar
jfreechart-1.0.12-LICENSE.txt
jfreechart-1.0.12.jar
jpa.jar
jxl-2.6.10-LICENSE.txt
jxl-2.6.10.jar
log4j-1.2.15-LICENSE.txt
log4j-1.2.15.jar
mondrian-3.1.1.12687-LICENSE.html
mondrian-3.1.1.12687.jar
png-encoder-1.5-LICENSE.txt
png-encoder-1.5.jar
poi-3.6-LICENSE.txt
poi-3.6-NOTICE.txt
poi-3.6.jar
rhino-1.7R1-LICENSE.txt
rhino-1.7R1.jar
saaj-api-1.3.jar
serializer.jar
servlet.jar
spring-2.5.5-LICENSE.txt
spring-beans-2.5.5.jar
spring-core-2.5.5.jar
xalan-2.7.1-LICENSE.txt
xalan-2.7.1.jar
xercesImpl-2.7.0-LICENSE.txt
xercesImpl-2.7.0.jar
xml-apis-ext.jar
xml-apis.jar
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Yes, that's what it's called. You can use the "jar" tool to examine the contents of a jar file, in particular to find out what classes it contains - and then compare that to the classes the compiler says are missing.

(Obviously, you would not put the *.txt files into the classpath.)
Amol More
Greenhorn

Joined: Jan 22, 2010
Posts: 29
hey hi
i got it i set my classpath to dir\dir\* and then all 99 errors have been resolved except for one

C:\jasperreports-4.0.0\src\net\sf\jasperreports\engine\fill\JRDistinctCountExten
dedIncrementerFactory.java:83: cannot find symbol
symbol : class DistinctCountHolder
location: class net.sf.jasperreports.engine.fill.JRDistinctCountExtendedIncremen
ter
private DistinctCountHolder lastHolder = new DistinctCountHolder();
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error


DistinctCountHolder is in the jaspers library file what could possibly wrong in library files
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jasper Reports
 
Similar Threads
Making Jasper Reports works.
compileing .jrxml file
JasperReports compileReport error
Showing blank page while running the report in Jasper
Making Jasper Reports works.