Java 加载一个文件,netbeans的默认位置

Java 加载一个文件,netbeans的默认位置,java,Java,我使用IDE netbeans运行java测试程序来加载文件。下面的代码将对此进行验证 public void actionPerformed(ActionEvent ae) { Object source = ae.getSource(); if (source==carMenuItem) { String filename = JOptionPane.showInputDialog("Please input the file n

我使用IDE netbeans运行java测试程序来加载文件。下面的代码将对此进行验证

public void actionPerformed(ActionEvent ae) {
        Object source = ae.getSource();


        if (source==carMenuItem) {

            String filename = JOptionPane.showInputDialog("Please input the file name");
            File file = new File(filename);
            System.out.println(file.isFile());
        }
    } 
}

但是我使用的是netbeans,为了成功测试程序,我应该将文件放在哪里?

最简单的方法是:

System.out.println(new File(".").getAbsolutePath());