Jump to content
We've recently updated our Privacy Statement, available here ×

Get the folder of the .JRXML or .JASPER file in Scriptlet


mulcamd

Recommended Posts

In my scriptlet I need to load a file.

This file should be in the same folder / directory as the report file (JRXML or JASPER).

Question: how can I determine the folder of the report I'm running?

I tried the code below: 

 

But this give the folder of the iReport, in my case:
Current dir : H:\Program Files\Jaspersoft\iReport-4.5.0  

Yet I need the folder / directory the report file is in.

Code:
public void afterReportInit() throws JRScriptletException{System.out.println("call afterReportInit");try {System.out.println ("Current dir : " + dir1.getCanonicalPath());} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
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...