Java 无法创建新文件:设备未就绪
我正在使用Java创建一个新文件,但遇到以下异常:Java 无法创建新文件:设备未就绪,java,file,file-io,Java,File,File Io,我正在使用Java创建一个新文件,但遇到以下异常: Exception in thread "main" java.io.IOException: The device is not ready at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:947) at pdfconverter.PdfConverter.main(PdfConver
Exception in thread "main" java.io.IOException: The device is not ready
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:947)
at pdfconverter.PdfConverter.main(PdfConverter.java:96)
Java结果:1
在我的第96行中,这种情况是:
if (!logfile.exists()) {
logfile.createNewFile();//line 96
}
我以前曾多次使用过这个amny,我不明白发生了什么,因为我是以管理员身份登录的。请帮助。问题在于路径,找不到,因为有人已将驱动器号从F重命名为D。很抱歉没有及时注意到这一点。如果在部署应用程序时在您的网络bean中发生此类错误,请打开此路径
C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.3\conf\Catalina\localhost
(它可能与tomcat安装目录不同)。有web.xml,您应该打开它并检查docBase=“D:\xyz\web\target\web”
是否由正确的项目库目录配置