Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing Problem in .jar?

 
Prashant Shirode
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The Report is print using netbeans and when we create .jar file is not printing they give error as follow??
net.sf.jasperreports.engine.JRException: Error compiling report java source file
s : C:\Users\Winner\Documents\NetBeansProjects\Service_care\dist\report32name_138
2940347930_211863.java C:\Users\Winner\Documents\NetBeansProjects\Service_care\di
st\report32name_Service_1382940347930_211863.java

I am using the Syntax for that is as follow:
jsperdesigns = getClass().getResourceAsStream("/Report/singleToken1.jrxml");
 
Stephan van Hulst
Bartender
Pie
Posts: 5797
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give us an SSCCE?
 
Prashant Shirode
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


InputStream jsperdesigns = this.getClass().getResourceAsStream("/Report/singleToken1.jrxml");
JasperDesign jd = JRXmlLoader.load(jsperdesigns);
The code is working with net beans. after that we create jar file using Clean and Build function.
When we run jar file the above code is not working,it show error message like i say earlier...

 
Stephan van Hulst
Bartender
Pie
Posts: 5797
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid this is not an SSCCE. Please click on the link in either of my two posts, and see how you can create one. We won't really be able to do much for you without one.
 
Prashant Shirode
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Error compiling report java source files...
This error message comes when we click on print button this problem come for only .jar file,
when i run project in net beans it print the actual report...
 
Tony Docherty
Bartender
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your path is correct. Starting it with a '/' means you are giving the absolute path rather than a path relative to the class' package name.
 
Prashant Shirode
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yes...
Also when i try with absolute path or relevant path both are not work in .jar file..
 
Tony Docherty
Bartender
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prashant Shirode wrote:
Yes...
Also when i try with absolute path or relevant path both are not work in .jar file..

How have you checked your path is correct? Have you checked to see if the returned stream is not null?
If it isn't null dump the stream to the console (or a file) to check the contents of singleToken1.jrxml are what you think they are - you may be picking up a different version of the file, an empty file etc.

As Stephan has said twice now, without seeing your code and preferably an SSCCE we are just guessing at possible fixes. The more effort you put into your posts the more likely you are to get your problem fixed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic