I want to dynamically set the document root in a program in Java. My Java program accepts 2 inputs:
- document root path as String
- an Int which I'm using for some calculations.
I set this document root in program, so that any use of File file=new File(filename)
will fetch the specified file from the document root path:
String f_path=args[0]; //within main().
f_path
could be any path in that system other than the root directory of the program.
Currently, when I do File file=new File(filename);
it searches for the specified file in the program's root directory. How can I change this to f_path
?