0

I have a function that gets a file path as an input. input file is located in a folder in my project (etc/xsd/template.xsd). how can i set this path?

this ia my function:

JAXBUtilityTool tool = new JAXBUtilityTool("etc/xsd/template.xsd","src.com.classes");

and it can not find the file "etc/xsd/template.xsd"

System.getProperty("user.dir") does not help since when I add the rest of path to it:

             System.getProperty("user.dir")+ "etc/xsd/template.xsd"

result is c:\eclipse\myworkingdirectory\project/etc/xsd/template.xsd

1 Answers1

0

Try:

String path = System.getProperty("user.dir");
path = path.replaceAll("\\","/") + "/etc/xsd/template.xsd"

Source:

String.replaceAll single backslashes with double backslashes

Community
  • 1
  • 1
  • I do not know why! but it works with path in c:/eclipse/myworkingdirectory/project/etc/xsd/template.xsd form not using \ so if i want to replace \ with / what is the characters I should use : string.replaceall("\", ?????) – user2316197 Jul 18 '13 at 17:02