-2

I had created a java application which creates a jasper report whenever user clicks the print button it provides a report. code: String

srcfile1="C:\\Users\\VINO\\Documents\\NetBeansProjects\\rework\\src\\rework\\report1.jasper";
JasperPrint firstsecondlinked = JasperFillManager.fillReport(srcfile1,map,cons); 

I copied the same to the colleague but it doesn't works fine giving an error states that file not found. As to create a application how to name the source file in the string?

Alex K
  • 22,315
  • 19
  • 108
  • 236
Vinoth
  • 1
  • 1

1 Answers1

0

You can do the following.

  • Specify the paths in some properties file and read it by loading that file. While deploying your application to some other machine, change the path before deployment.

application-resources.properties report1.path=''

  • If it's a web-application, you can access any resource inside your application by using request.getContextPath(). You will not need to hard code it like C:\Users\VINO.. Only the relative path will suffice.
amdg
  • 2,211
  • 1
  • 14
  • 25