Jump to content
Changes to the Jaspersoft community edition download ×

Deploying the application in a file.jar

Recommended Posts

By: Gabriel - acharat

Deploying the application in a file.jar

2002-12-12 03:12



I have a problem with:

I generated my application in a file.jar. In this file are included the files .jasper.


To get the path to these files I use:

URL u = new classN().getClass().getResource(namefile);

return u.getFile();


then I have this path: file:c:packagefile.jar!comreport.jasper


but I receive one exception:





This path is correct, but I think that Jasper is doesn't finding this file.

What can I do to find a file.jasper inside a file.jar ?


Thank you,






By: Uwe J ger - uwej

RE: Deploying the application in a file.jar

2002-12-12 03:53

Don't use the URL.getFile() method rather the ClassLoader.getResourceAsStream() method and pass on the stream to jasper. This should work whereever you place the files (as long the classloader can load them ...)





By: Gabriel - acharat

RE: Deploying the application in a file.jar

2002-12-12 08:17

Thank you for your answer.


But I forgot to tell that I need to use the path of the jasper file to the method:


JasperFillManager.fillReportToFile(fileName, parameters, classBD);


This method requires a String or a JasperReport object in the first parameter, then I cannot pass a getResourceAsStream as you told me to.


Do you have any sugestion ?


Thank you again,


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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