java - How to use relative paths in the given below code? -


consider code sample below. migrator class takes 2 input files, processes , writes output final.tbl. want final.tbl created on same path folder of input files present. execute method should take relative path of generated final.tbl file.

 public class migrator{       public void migrate(string path1,string path2){           printstream out = new printstream("final.tbl");//i need relative path of input folder path i.e path1,path2            //.....            //.....processing        }  }   class mainprocess{        public execute(string path){           //here execute method should the relative path of above final.tbl file        }         public static void main(string args[]){         }  } 

path path = paths.get(path1); printstream out = new printstream(path.getparent().tostring() + "\\final.tbl"); 

Comments