์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์„ ์งœ๋‹ค๋ณด๋ฉด ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์˜ root ๊ฒฝ๋กœ๋ฅผ ํ•„์š”๋กœ ํ•  ๋•Œ๊ฐ€ ์žˆ๋‹ค.


๊ทธ๋Ÿด ๊ฒฝ์šฐ ์•„๋ž˜์ฒ˜๋Ÿผ 


public static void main(String[] args) {
       
      System.out.println("Current Working Directory = " + System.getProperty("user.dir"));
}

System.getProperty ๋ฉ”์„œ๋“œ์— user.dir ์„ ์ธ์ž๋กœ ๋„ฃ์–ด์ฃผ๋ฉด ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์˜ root ๊ฒฝ๋กœ(absolute path)๋ฅผ String ์œผ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.


Use 'System.getProperty("user.dir")' method for getting current working directory as absolute path. The method returns a string value of the root path of the java project as an absolute path.