, java.io.File
getPath() .
:
System.out.println(System.getProperty("user.dir"));
File file = new File("example.txt");
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
, : java.io.File.getAbsolutePath().
: java.io.File.getAbsoluteFile(). getPath().
:
, :
String[] cmd = {"touch /home/pc/example.txt"};
Runtime.getRuntime().exec(cmd);
, os "touch /home/pc/example.txt".
: "WTF? ?"
Runtime.getRuntime().exec(String cmd); .
Runtime.getRuntime().exec(String[] cmdarray); . , :
String[] cmd = {"touch", "/home/pc/example.txt"};
Runtime.getRuntime().exec(cmd);