问题描述
我用JDK 1.6.0_20和Netbeans 6.9.1安装了新的硬盘驱动器.我从旧驱动器中复制了一个现有的Netbeans项目,并将其导入到NB 6.9.1中.
I installed a new hard drive with JDK 1.6.0_20 and Netbeans 6.9.1. I copied an existing Netbeans project from the old drive and imported it into NB 6.9.1.
现在它突然创建输出文件,并在c:\ windows目录而不是项目目录中写入Log4J .log文件.
Now it is suddenly creating output files and writing Log4J .log files in the c:\windows directory instead of the project directory.
我在NB外的下方创建了测试类,以查看发生了什么.在NB外部运行此命令可获得预期结果.将此类导入到新的NB项目中也可以获得预期的结果.但是,如果我将此类复制到另一个项目中,那么它将为所有3个输出提供c:\ windows.
I created the test class below outside of NB to see what is happening. Running this outside of NB gives the expected results. Importing this class into a new NB project also gives the expected results. But if I copy this class into the other project then it gives c:\windows for all 3 outputs.
这个项目可能会导致它像项目目录是c:\ windows那样出现问题?
What could be the problem with this one project that causes it to act like it's project directory is c:\windows?
public class DirectoryTest {
public static void main(String[] args) {
String userDir = System.getProperty("user.dir");
System.out.println(userDir);
File file = new File(".");
try {
System.out.println(file.getCanonicalPath());
System.out.println(file.getAbsolutePath());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
推荐答案
您可以尝试删除nbproject
& build
文件夹,并将其重新创建为具有现有源的项目".
You could try deleting the nbproject
& build
folders and re-creating it as a "Project with Existing Sources".
作为最后的选择,请从平台上的NetBeans缓存文件夹中删除该文件夹,通常将其删除到主目录的隐藏文件夹中.
As a last resort, delete the NetBeans cache folder from wherever it is stored on your platform, typically in a hidden folder of your home directory.
这篇关于Netbeans突然创建文件并将日志输出写入c:\ windows目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!