Jump to content
JasperReports Library 7.0 is now available ×

location of jrxml files


jojoala

Recommended Posts

I designed some reports with iReport / Jasper report. It all works fine while running it under the netbeans IDE, but once I generate a dist and start the application from the .jar file, the reports don't print. I guess it can't find the jrxml and the jasper files. I tried copying the files to various locarions - on the root, inside the .jar file in many different locations (in the root of the .jar, in the .class dir, in a report sub dir with in the class dir, in a sub dir inside the lib dir,. loose with in the lib dir....) and nothing works.

I tried marking the sub-report dir as ".\reports

" and also as ".

" - nothing works...

 

Where and how should I include those files in the dist package??

 

Thanks

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

 

First, you need to read this FAQ and understand when you need to compile JRXML:

http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/jasperreports/faq.html#FAQ22

 

 

Then, we recommend using classpath relative locations for all static resources used by a report such as images, fonts, subreports, etc.

This way, when you package your application files in a JAR, no matter where you deploy, the relative classpath locations of resources within that JAR will remain the same.

 

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Hi,

 

Thanks for the reply.

2 questions:

1. I can and want to compile the templates, but I couldn't find anywhere the command to replace:

Code:

JasperDesign jasperDesign = JRXmlLoader.load(printLocation + file);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

and use the .jasper file instead.

 

2. The location question again... You suggest using relational location - in relation to which location though? The .jar file is located in subdir "dist", and within the .jar file there are few other dirs - that's where I am lost...

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...