• Post Reply Bookmark Topic Watch Topic
  • New Topic

Relative paths

 
manuja meneripitiya
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an jasper report file in location -->>> G:\K_MED\src\lk\starorient\kmed\report\report.jrxml

It should be accessed by the java class located in G:\K_MED\src\lk\starorient\kmed\view\Myclass.java

It works when the given path is "G:\\K_MED\\src\\lk\\starorient\\kmed\\report\\MedReport.jrxml" in the java class.

but it is an absolute path

How could i write the relative path for this jasper file in Myclass.java

Thanks.........
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your class name is lk.starorient.kmed.view.Myclass then you can use a relative resource: ../report\report.jrxml. Check out Class.getResource(AsStream) for more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!