import java.io.File; public class CurrentDirectory { /** * @param args */ public static void main( String [] args ) { try { System.out.println( "Current dir : " + new File( "." ).getCanonicalPath() ); System.out.println( "Parent dir : " + new File( ".." ).getCanonicalPath() ); } catch ( Exception e ) { e.printStackTrace(); } } }