Questions tagged [filenotfoundexception]

A Java or Android exception that indicates that the file denoted by a specified pathname could not be opened.

This exception is part of the old Java file API. Newer code in Java (note: NOT Android) should use JSR 203 instead (i.e. Paths, Files). JSR 203 (known as NIO.2) has its own java.nio.file.NoSuchFileException, see also .

One problem with this exception is that despite its name, it doesn't always mean that the filesystem object at the given path is actually missing. Here are a few possibilities where this exception can be thrown with a cause other than the file missing:

  • permission denied: an attempt is made to open the file in write mode but the process only has read only access; or the file is in a directory the contents of which the application cannot access;
  • read only filesystem: an attempt is made to open the file in write mode, the process has write access to the file but the underlying filesystem is read only;
  • symbolic link loop: the denoted path is a symbolic link which loops on itself.
1712 questions
4
votes
3 answers

Downloading on Android - FileNotFoundException but file exists

I tried to download a file from a server in Android but all I get is a FileNotFoundException. My download method works fine for all files I give it, but not on this one specific url. The url it is not working on looks like this:…
metaclypse
  • 43
  • 1
  • 7
4
votes
1 answer

SparkJob in multinode cluster: WARN TaskSetManager: Lost task 0.0 in stage 0.0: java.io.FileNotFoundException

I have just set up a Spark multi-node cluster. My cluster is made of an iMac and a couple of Raspberry all linked via Ethernet with ssh passwordless access to one another. The Spark command I'm trying to execute is: spark-submit --master…
SteveRoss
  • 105
  • 11
4
votes
1 answer

How to catch a FacesFileNotFoundException?

How can I catch a com.sun.faces.context.FacesFileNotFoundException in a Java EE web application? I tried it with adding the following lines in my web.xml file but I was not successful: ... 404
Benny Code
  • 51,456
  • 28
  • 233
  • 198
4
votes
2 answers

SparkContext.addFile upload the file to driver node but not workers

I tried to run a sc.texfile("file:///.../myLocalFile.txt") on a cluster and I got java.io.FileNotFoundException on the workers. So I googled and I found sc.addFile / SparkFiles.get to upload the file to each workers. So here is my…
stackoverflowed
  • 686
  • 8
  • 22
4
votes
3 answers

Multipart transferTo looks for a wrong file address when using createTempFile

I have the following java code in Spring framework to convert a multipart file to a regular file: public static File convertToFile(MultipartFile multipart) { File convFile = null; try { convFile =…
Arian
  • 7,397
  • 21
  • 89
  • 177
4
votes
2 answers

ERROR: android.content.res.Resources$NotFoundException

I recently tried to add a launch(splash) screen to my app, But an error is occurring all the time i try to run the app by the emulator. this is the error log: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.aidin.workbook, PID:…
4
votes
2 answers

FileNotFoundException when using dll method

in Visual Studio I have a solution with several projects. In one project I added a reference to another project. All fine. I can see the namespaces/classes of the another project in autocomplete, etc. When I try to do OtherProjectNamespace.Class a…
carlosdubusm
  • 1,063
  • 4
  • 11
  • 22
4
votes
2 answers

FileNotFoundException when trying to create a File in Android

I'm trying to use Jexcel API to create an excel file and write to it using my application on my phone. When I run the app, it throws a FileNotFoundException. I even tried creating a text file according to an answer to another such question, but it…
keshav johar
  • 55
  • 1
  • 4
4
votes
3 answers

java.io.FileNotFoundException while running java app from jar file

Hi i am running java app from jar file. like following java -cp test.jar com.test.TestMain . in the java app i am reading csv file. which is throwing below exception. java.io.FileNotFoundException:…
Harinath
  • 105
  • 1
  • 4
  • 12
4
votes
2 answers

Properties not found with Spring PropertySource

Config @Configuration @PropertySources({ @PropertySource("classpath*:properties/test-database.properties") }) public class DataSourceConfiguration {//... } Prop…
Arthur
  • 1,156
  • 3
  • 20
  • 49
4
votes
5 answers

java.io.FileNotFoundException, open failed: ENOENT

For some reason I am getting a fileNotFoundException for both the times I read. Something worth noting is that the Toast prints "File exists!". I used the BufferedReader at the bottom to test if the content of the file is correct. @Override public…
D. Rao
  • 423
  • 2
  • 6
  • 16
4
votes
1 answer

Check that a DocumentFile exists

I check a files meta data and existence using DocumentFile. This is instanciated thusly: DocumentFile df = DocumentFile.fromSingleUri(context, uri); boolean exists = df.exists(); The uri to the file worked previously, until I purposefully deleted…
Knossos
  • 15,802
  • 10
  • 54
  • 91
4
votes
1 answer

Common Facelets files in shared library JAR outside /WEB-INF/lib

I have a common shared Library (that is setup as a Shared Library in Websphere Application server). The folder structure of that jar is: UtilityJAR ----src -com -test -TestClass.java ---- META-INF -resources …
user972391
  • 321
  • 1
  • 4
  • 20
4
votes
2 answers

how to use printwriter to create and write to a file

I am trying to create a new file and print data to said file using the printwriter class. My code looks like this File Fileright = new File("C:\\GamesnewOrder.txt"); PrintWriter pw = new PrintWriter(Fileright); for(int i…
Brandon Nolan
  • 125
  • 1
  • 2
  • 10
4
votes
1 answer

Java Access Denied Printing to Receipt Printer on Windows 7

I developed a Java POS system about 11 years ago that currently still runs on Windows XP and Vista machines. I am in the process of updating them to Windows 7 and now having issues printing to the Star Micronics Thermal Receipt Printers. Here is…