Jump to content

Use jasperreport (jrxml compilation) with JWS (java web start)


seboss

Recommended Posts

 Hi,

First of all, I'm sorry for my English. I hope you'll understand my problem...

I used jasperreport with no problem since a few years with java web start and I want to improve my program with "dynamic report". I mean that I need to compile JRXML on client machine (before I was using precompiled .jasper file to generate report with no problem).

On a local machine, there is no problem with the code. But when I use java web start, with all needed jars in the JNLP file, I have the following errors :

"net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:

C:\Users\Sébastien\Downloads\templatePortrait_1288690396822_552631.java:4: package net.sf.jasperreports.engine does not exist

import net.sf.jasperreports.engine.*;

^

...."

I found why it's not running. The classpath is not configured with the requested jar file with java web start whereas, in local, the classpath is properly configured.

I search for a suitable solution but I didn't find anything that can be used.

I tried to get the path of the jar to update the classpath on a client machine. A getResource() on a file in the required jar :

System.out.println(getClass().getClassLoader().getResource(sourcePath));

Returns :

jar:http://192.168.1.11:80/lib/report.jar!/report/templatePortrait.jrxml

Not a local file. So i can't add the jar file in the classpath.

When I copy jasperreport.jar in jre/ext/ path, it works, but it can't be deploy on all client machines...

Does anybody have a solution ?

Code:
String sourcePath = "report/templatePortrait.jrxml";InputStream in = getClass().getClassLoader().getResourceAsStream(sourcePath);JasperReport jasperReport = JasperCompileManager.compileReport(in);
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...