Exception in thread "main" java.io.IOException: No such file or directory

This is for core Java, java script, Struts, Jsp, Servlet, Spring, EJB etc. Programming Language and Framework
mina1234
Posts: 72
Joined: Tue May 05, 2015 7:08 pm
Contact:

Exception in thread "main" java.io.IOException: No such file or directory

Postby mina1234 » Thu Oct 01, 2015 8:53 pm

I am getting below error while running the java program in linux. The file is there but somehow it is saying no file.

Exception in thread "main" java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1006)
at TestFile.main(TestFile.java:31)


Guest

Re: Exception in thread "main" java.io.IOException: No such file or directory

Postby Guest » Mon Apr 04, 2016 7:16 pm

Print the full file name with the path and see it is giving correct path which you are looking.

File f = new File("dir1/dir2/test.doc");


If file is there than you can give the full path and may copy the file where your java program is running.


Return to “Core Java and Advanced Java Programming or development”

Who is online

Users browsing this forum: No registered users and 1 guest