Relative path for subreport

1

Hi @all,

searching this forum, I found no hint to solve my problem:

I have a report (iReport 3.7.4, Win7-64) in this directory: C:\\Users\\Public\\DocMgr\\JRXML\\Personen\\Listen_Personen\\

Subreports should be placed in: C:\\Users\\Public\\DocMgr\\JRXML\\subreports

As I don't know the directory structure of the target pc, I've to address the subreport relatively. This should be solved via the parameter "SUBREPORT_DIR". This works fine if I fill it with the absolute path (C:\\\\Users\\\\Public\\\\DocMgr\\\\JRXML\\\\subreports\\\\) - but not with the relative one (..\\\\..\\\\subreports\\\\). I suppose, that my syntax for relative adressing is wrong... the error message is: java.lang.Exception: ..\\..\\subreports\\mysubreport.jrmxl not found

Can anybody help?

toxy

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago

10 Answers:

0
Try this in the subreport expression:
"../../subreports/reportName.jasper"
anode36's picture
14
Joined: Jul 20 2010 - 2:15pm
Last seen: 8 years 10 months ago
0

this have been one of my multiple tries...

--> java.lang.Exception: ../../subreports/briefkopf_hoch.jrxml not found

thanks

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago
1
Hi,
looks like you are calling the .jrxml file in the expression. You need to call the compiled .jasper file. (../../subreports/reportName.jasper).

Hope this can help you.
anode36's picture
14
Joined: Jul 20 2010 - 2:15pm
Last seen: 8 years 10 months ago
0

hm, the "Subreport Expression" is  $P{SUBREPORT_DIR}+"briefkopf_hoch.jasper". In the subdirectoy there are both files. Somwhere there is the setting "compile supreports" or similar... so iReports tries to compile it --> jrxml  (if I understand it correctly).

thanks

toxy

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago
0
Hi,
The jrxml file is just the file used for development. The JaspersReport engine uses the compiled file (.jasper) for processing the report. iReport automatically compile the jrxml file before executing the jasper file itself.

I guess the $P{SUBREPORT_DIR} parameter defaults to the same directory as the master report like this "". If you haven't done yet maybe you need to set this parameter to "../../subreports" first.

Personally I just use the relative path directly as the suberport expression, reffering to the relative location of the .jasper file.
anode36's picture
14
Joined: Jul 20 2010 - 2:15pm
Last seen: 8 years 10 months ago
0

anode36
Wrote:

Personally I just use the relative path directly as the suberport expression, reffering to the relative location of the .jasper file.

This is interesting... how do you write this exactly? In my case I would write: ""..//..//subreports//briefkopf_hoch.jasper" wich is interpreted by the compiler as "../../subreports/briefkopf_hoch.jasper". This expression is correct in all my knowledge of 20 years in IT... but doesn't work! :-(

greetings

toxy

( backslashes printed as slashes!)



Post Edited by toxy at 09/15/2010 06:46
toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago
0
...seems to be a problem in the settings of the installation?!

toxy,
continuing searching...
toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago
0

 I''ve got the same problem.

I want to reference a subreport in a previous folder like this:

../mysubreport.jasper

 

Every time ireport couldn't find that one.

Any suggestion?

Thx

lotus4's picture
11
Joined: Feb 24 2011 - 5:57am
Last seen: 8 years 2 months ago
0

 ah, wow! i've found this topic:

http://old.nabble.com/Relative-paths-to-an-image-td20342359.html

 

it's seems to be a jdk 1.6 problem (strange..).

Anyway if you put your resources in classpath it will work! ;)

lotus4's picture
11
Joined: Feb 24 2011 - 5:57am
Last seen: 8 years 2 months ago
0

The problem was solved by our db-developer... the calling application overwrites the parameter "SUBREPORT_DIR" with the right value of the actual installation. So I can develop my reports with a fixed subreports-path according to my installation, customer's installation doesn't bother me...

toxy

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 6 months ago
Feedback
randomness