how to get the absolute path of file object java code example Example: java file path linux Scanner s = new Scanner(new File("/home/me/java/ex.txt"));