fork download
  1. import java.io.File;
  2. class CurrentDir {
  3. public static void main (String args[]) {
  4. File dir1 = new File (".");
  5.  
  6.  
  7. try {
  8. System.out.println ("Current directory's canonical path:" + dir1.getCanonicalPath());
  9. System.out.println ("Current directory's absolute path : " + dir1.getAbsolutePath());
  10.  
  11. System.out.println("User Home Path: "+System.getProperty("user.dir"));
  12. }
  13. catch(Exception e) {
  14. e.printStackTrace();
  15. }
  16. }
  17. }
Success #stdin #stdout 0.02s 246656KB
stdin
Standard input is empty
stdout
Current directory's canonical  path:/home/fNHYfv
Current directory's absolute path : /home/fNHYfv/.
User Home Path: /home/fNHYfv