This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Printing Problem in .jar? 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 » Java » Java in General
Bookmark "Printing Problem in .jar?" Watch "Printing Problem in .jar?" New topic
Author

Printing Problem in .jar?

Prashant Shirode
Greenhorn

Joined: Oct 08, 2013
Posts: 19

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

Joined: Sep 20, 2010
Posts: 3361
    
    9
Can you give us an SSCCE?
Prashant Shirode
Greenhorn

Joined: Oct 08, 2013
Posts: 19


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

Joined: Sep 20, 2010
Posts: 3361
    
    9
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

Joined: Oct 08, 2013
Posts: 19

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

Joined: Aug 07, 2007
Posts: 1934
    
  28
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

Joined: Oct 08, 2013
Posts: 19

Yes...
Also when i try with absolute path or relevant path both are not work in .jar file..
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 1934
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing Problem in .jar?
 
Similar Threads
Mark cannot be converted to int
Accessing a class in another Package
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type
What does - class, interface, or enum expected - mean?
error in creating jar files