raphy Posted September 12, 2006 Share Posted September 12, 2006 Hello!Is it possible to set a relative path (instead of an absolute path like D:\dev\myproject\images\logo.jpg") to a image contains in the report.Thanks for your replyBest regards RaphyPost edited by: raphy, at: 2006/09/12 09:00 Link to comment Share on other sites More sharing options...
Sunitha Posted September 12, 2006 Share Posted September 12, 2006 hi allhey even i am trying for the relative pathi want to give the path through java program or dynamically it should take the path Link to comment Share on other sites More sharing options...
sforgelogin Posted September 13, 2006 Share Posted September 13, 2006 It is possible to use a relative path I believe, but I would not recommend it since if you plan to make your report accessible via servlet you need an absolute path for subreport linkage to work. A solution that I found to work very well is to make your subreport and file link paths of type "file" and use something like: new File($P{BaseDir},"/subreport.jrxml") in the path. Then make a report parameter called "BaseDir" and set it to the base directory. You can do the same thing for image files and it makes it very easy to port your report to different places just by changing the parameter. If you have nesting of subreports make sure you pass the BaseDir parameter down so that it only needs to be set on the main report file. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted September 13, 2006 Share Posted September 13, 2006 The baseDir approach is the best one.Relative paths are resolved starting from the process current directory (they are not relative to the jasper file).Please note that a resource, if not reference a valid path, is looked into the classpath. Giulio 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