public static void update(File directory){
  if (directory != null && directory.exists()) {
    Properties sysProps=new Properties(System.getProperties());
    sysProps.setProperty("user.dir",directory.getAbsolutePath());
    System.setProperties(sysProps);
  }
}

public static void update ( File directory ) { if ( directory != null && directory . exists ( ) ) { Properties sysProps = new Properties ( System . getProperties ( ) ) ; sysProps . setProperty ( "user.dir" , directory . getAbsolutePath ( ) ) ; System . setProperties ( sysProps ) ; } }
update currentsirectory to be the supplied directory .
