Stanley Mungai
Stanley Mungai

Reputation: 4150

Cannot Create New file: The device is not ready

I am Creating a new File using Java but am getting tis exception:

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 Result: 1

In My line 96 is this Condition:

if (!logfile.exists()) {
        logfile.createNewFile();//line 96
    }

I have used this amny times before and I do not understand what's going on Because I am logged in as Administrator. Please Help.

Upvotes: 6

Views: 15966

Answers (2)

JIGNESH PARMAR
JIGNESH PARMAR

Reputation: 1

If this kind of error occurred in your net-beans while you deploying an app then open this path C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.3\conf\Catalina\localhost (it might be different as your tomcat installation dir). There is web.xml you should open it and check docBase="D:\xyz\web\target\web" is configured by proper project base directory or not.

Upvotes: -2

Stanley Mungai
Stanley Mungai

Reputation: 4150

The problem was the Path, which was not found because someone had renamed the drive letter from F to D. Sorry for not noticing that In time.

Upvotes: 15

Related Questions