Jump to content

Relative path for a image file


raphy

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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