• 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

jasperreports does not work in executable jar file

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
I'm quite new to java, jasperreports and programming in general...

I've got a java application, where a checklist can be filled in, which is stored and loaded from a database.
I use netbeans, with a SQLite database and the IReports plugin for the design of the printed page.
In the end It can be saved as a PDF file using jasperreports.

The problem now is...the html file nicely shows up in Jasperviewer when I'm running the application in Netbeans.
But when I just run the created executable .jar file...and then click my *create PDFbutton*, nothing happens.
Jasperviewer doesnt show, and no report is created anyway. I've been trying to fix this for the last two weeks...and I'm just stuck...

Does anyone have an idea where the problem might be?

Below is the code I use to create the PDF file.

Thanks alot,

Elwin



 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite possibly the problem is that the manifest of the executable jar file doesn't have Class-Path entries which correctly refer to the other jars you need to run it.

If you go to a command line and type the command "java -jar WhateverYourJarIsCalled.jar" then you should get some kind of error message. Without error messages it can be extremely difficult to identify the problem (as you are finding out).
 
elwin Ilam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick response,

But could you translate that into noob language for me?
I opened cmd.exe and tried your command...That just gives me an 'java is not recognized as an internal or external command, program or file' error.

I tried to open the manifest file from my project...but that's only 85 bytes... and looks kind of empty.
Maybe netbeans corrupts the manifest somehow?

Kind regards,
Elwin
 
elwin Ilam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I removed all the unnessecary stuff from the code,
which now produces a simple one line pdf.

however, the program still does not do anything when outside netbeans and I'm out of ideas.
I hope this simple example will making me help easier.

Thanks a lot,
Elwin

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul...
my name is lakhvinder Singh....
i am having the same problem as with Elwin..
i run my program by using this command:
i found this error in now..tell what to do now..
.

comand i use is:
D:\Users\Lucky24x7>java -jar "D:\Users\Lucky24x7\Documents\NetBeansProjects\Cust
omerManager\dist\CustomerManager.jar"

Error:

Jul 16, 2012 3:38:04 PM org.springframework.beans.factory.xml.XmlBeanDefinitionR
eader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [jar:file:/D:/Users/Lucky24x7/Docume
nts/NetBeansProjects/CustomerManager/dist/lib/jasperreports-chart-themes-4.5.0.j
ar!/net/sf/jasperreports/chartthemes/spring/beans/chartThemesBeans.xml]
Jul 16, 2012 3:38:04 PM net.sf.jasperreports.extensions.DefaultExtensionsRegistr
y loadRegistries
SEVERE: Error instantiating extensions registry for chart.theme
org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML do
cument from URL [jar:file:/D:/Users/Lucky24x7/Documents/NetBeansProjects/Custome
rManager/dist/lib/jasperreports-chart-themes-4.5.0.jar!/net/sf/jasperreports/cha
rtthemes/spring/beans/chartThemesBeans.xml] is invalid; nested exception is org.
xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE roo
t "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE
root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
ParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unk
nown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootEleme
ntSpecified(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleSta
rtElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElem
ent(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Conten
tDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Prolog
Driver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unk
nown Source)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:68)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:56)
at net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory.getBe
anFactory(SpringExtensionsRegistryFactory.java:101)
at net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory.creat
eRegistry(SpringExtensionsRegistryFactory.java:73)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.instantiate
Registry(DefaultExtensionsRegistry.java:238)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistr
ies(DefaultExtensionsRegistry.java:213)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistr
ies(DefaultExtensionsRegistry.java:163)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getRegistri
es(DefaultExtensionsRegistry.java:133)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensio
ns(DefaultExtensionsRegistry.java:105)
at net.sf.jasperreports.engine.component.ComponentsEnvironment.findCompo
nentBundles(ComponentsEnvironment.java:89)
at net.sf.jasperreports.engine.component.ComponentsEnvironment.getCached
ComponentBundles(ComponentsEnvironment.java:78)
at net.sf.jasperreports.engine.component.ComponentsEnvironment.getCompon
entBundles(ComponentsEnvironment.java:66)
at net.sf.jasperreports.engine.xml.JRReportSaxParserFactory.getSchemaLoc
ations(JRReportSaxParserFactory.java:76)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.configureParser(
BaseSaxParserFactory.java:131)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(Bas
eSaxParserFactory.java:94)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRX
mlDigesterFactory.java:1342)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(J
RXmlDigesterFactory.java:1318)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207
)
at ReportTest.okActionPerformed(ReportTest.java:97)
at ReportTest.access$000(ReportTest.java:34)
at ReportTest$1.actionPerformed(ReportTest.java:58)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
net.sf.jasperreports.engine.JRException: java.net.MalformedURLException
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:
251)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:
230)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218
)
at ReportTest.okActionPerformed(ReportTest.java:97)
at ReportTest.access$000(ReportTest.java:34)
at ReportTest$1.actionPerformed(ReportTest.java:58)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrent
Entity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineD
ocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1745)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:
243)
... 41 more
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic