2001 JI Open Discussion Posted August 17, 2006 Share Posted August 17, 2006 By: Gabriel - acharat Deploying the application in a file.jar 2002-12-12 03:12Hi, 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: dori.jasper.engine.JRException: file:c:packagefile.jar!comreport.jasper 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, Acharat By: Uwe J ger - uwej RE: Deploying the application in a file.jar 2002-12-12 03:53Don'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 ...) Uwe By: Gabriel - acharat RE: Deploying the application in a file.jar 2002-12-12 08:17Thank 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, Acharat Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now