This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Jasper Reports  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 3281
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set the jasperreports jar file to be in your CLASSPATH.
 
Amol More
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JasperReports probably consists of quite a few jar files - they all need to be in the classpath.
 
Amol More
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3281
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you building this? Maven? Ant? or a shell/batch script?
 
Ulf Dittmer
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Oh the stink of it! Smell my tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!