[Java]相対指定したファイル名からそのファイルのあるディレクトリの絶対パスを取り出したい。
 標準のメソッドではできないのか。。File#getParent()はnullになる。   環境   iotest.java   import java.io.*;  public class iotest {  public static void main(String... args){  File f = new File(args[0]);  try { System.out.println( args[0]+" exists: "+f.exists()); System.out.println("getPath(): "+f.getPath()); System.out.println("AbsolutePath(): "+f.getAbsolutePath()); System.out.println("CanonicalPath(): "+f.getCanonicalPath()); System.out.println("parent(): "+ f.getParent()); }catch (IOException e){}   }   }   コンパイル  D:\iote>javac iotest.java    iotest.classはD:\ioteに存在するファイル  dam.txtはD:\ioteに存在しないファイル   実行1  D:\iote>java iotest iotest.class  結果1  iotest.class exists: true  getPath(): iotest.class  AbsolutePath(): D:\iote\iotest.class  CanonicalPath(): D:\iote\iotest.class  parent(): null   実行2  D:\iote>java iotest D:\iote\iotest.class  結果2  D:\iote\iotest.class exists: true  getPath(): D:\iote\iotest.class  AbsolutePath(): D:\iote\iotest.class  Canonica...
