JFileChooser FileOpen = new JFileChooser();
FileOpen.getCurrentDirectory();

解决方案 »

  1.   

    File f = new File(); 
    f.getPath();
      

  2.   

    java.io.File f = new java.io.File(); 
    f.getPath();这个老是报错,No constructor matching File() found in class java.io.File.
      

  3.   

    java.io.File f = new java.io.File("文件名"); 
    f.getPath();
      

  4.   

    File f = new File(".");
    ...
      

  5.   

    如果在Servlet中,还可以response.getRealPath("文件夹or文件名or.");
      

  6.   

    在web中:
    用request.getRealPath("");或阿application.getRealPath("");
    得到web所在的绝对路径!
    然后加上相对路径就可以了!在application中:
    用System.getProperty()得到工作目录
      

  7.   

    在web中:
    用request.getRealPath("");或application.getRealPath("");
    得到web所在的绝对路径!
    然后加上相对路径就可以了!在application中:
    用System.getProperty("user.dir")得到工作目录我写了一个自己觉得很经典的日志类,不过在公司!
    要的话发信给我[email protected]
      

  8.   

    在web中:
    用request.getRealPath("");或application.getRealPath("");
    得到web所在的绝对路径!
    然后加上相对路径就可以了!在application中:
    用System.getProperty("user.dir")得到工作目录我写了一个自己觉得很经典的日志类,不过在公司!
    要的话发信给我[email protected]