본문 바로가기
프로그래밍/자바

파일 경로 분해

by LillyLt 2015. 7. 25.




public class 파일경로EX1_p848 {

/**

* <pre>

* TODO

* </pre>

* @since 2015. 7. 8. 오전 9:30:51

* @author Holy

* @version 

* @param args

* @throws IOException 

*/

public static void main(String[] args) throws IOException {

// TODO Auto-generated method stub

File f=new File("src/파일/파일EX1_p848.java");

String fnm=f.getName();

int ps=fnm.lastIndexOf(".");

System.out.println(f.getName());

System.out.println(fnm.substring(0, ps));

System.out.println(fnm.substring(ps+1));

System.out.println();

System.out.println(f.getPath());

System.out.println(f.getAbsolutePath());

System.out.println(f.getCanonicalPath());

System.out.println(f.getParent());

System.out.println();

System.out.println(File.pathSeparator);

System.out.println(File.pathSeparatorChar);

System.out.println(File.separator);

System.out.println(File.separatorChar);

System.out.println();

System.out.println(System.getProperty("user.dir"));

System.out.println(System.getProperty("sun.boot.class.path").replaceAll(";", ";\n"));

}

}