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
25
votes
1 answer

FileNotFoundException: "Could not load file or assembly" although assembly exists

I am trying to create a custom membership and role provider. The code for this seems to be fine, but when I try to go to the Security section of the Web Site Administration Tool, I get the following: The invoked member is not supported in a…
25
votes
7 answers

How do I fix the error "Could not load file or assembly 'System.Text.Json, ..."?

I created in VS Code a new classlib project. I added two packages to my project: PowerShellStandard.Library + System.Text.Json. My csproj file contains this block:
Alex_P
  • 2,580
  • 3
  • 22
  • 37
24
votes
1 answer

FileNotFoundException (permission denied) when trying to write file to sdcard in Android

As you can notice from title, I have a problem with writing file to sdcard in Android. I've checked this question but it didn't help me. I want to write file that will be in public space on sdcard so that any other app could read it. First, I check…
Drag0
  • 8,438
  • 9
  • 40
  • 52
24
votes
6 answers

java.io.FileNotFoundException (permission denied) despite chmod 777

I have faced strange poblem while writing Grails application deployed on Tomcat. After creating simple test controller I want to write test contents in package com package com.domain.controller import java.io.File; import…
Athlan
  • 6,389
  • 4
  • 38
  • 56
23
votes
4 answers

FileNotFoundException in src/main/resources

i placed a file in my maven project under src/main/resources the files name is simply temp.txt. When i try to open the file: BufferedReader br = new BufferedReader(new FileReader(new File("./temp.txt"))); I get an error: Exception in thread "main"…
Mulgard
  • 9,877
  • 34
  • 129
  • 232
21
votes
5 answers

FileNotFoundException when calling webservice

Hello I got past my initial problem. I'm a total android noob, this is my first app. I'm testing this on the Android emulator. I try to connect to a .NET webservice at http://192.168.3.47/service.asmx. I get a FileNotFoundException. But it IS…
gyozo kudor
  • 6,284
  • 10
  • 53
  • 80
19
votes
4 answers

Android APIv29 FileNotFoundException EACCES (Permission denied)

I'm not able to access storage when building for targetSdkVersion v29. Here is my gradle configuration: compileSdkVersion 29 buildToolsVersion "29.0.2" ... minSdkVersion 15 targetSdkVersion 29 NOTE that…
18
votes
2 answers

Reading file from assets directory throws FileNotFoundException

I'm trying to read in a text file of a bunch of words that I want to use for a word game I am writing. This list is stored in the assets directory and is a txt file. But, whenever I attempt to open it, it throws an exception. ListwordList =…
17
votes
6 answers

why sometime it throws FileNotFoundException

The code works for most of the time, but some time it throws exception. Couldn't figure out what could cause it. What is does is to create a file at /storage/emulated/0/Download/theFileName.jpg and write data to it (from sourceFile which does…
lannyf
  • 9,865
  • 12
  • 70
  • 152
17
votes
4 answers

Java java.io.filenotfoundexception for file path with cyrillic characters

I have a file whose name contains characters not only from the plain ASCII character set, but also from a non-ASCII character set. In my case it contains Cyrillic characters. Here's a snippet of my code: String fileName =…
Dmitry Nelepov
  • 7,246
  • 8
  • 53
  • 74
17
votes
2 answers

Azure package not including linked project DLL even with copy local set

I've an Azure solution with 4 projects in it. (VS 2012 on Windows 8, Azure Tools 1.8) Core project with common code Web Role Front End Service Role for servicing data (from SQL Azure DB) Worker Role for scheduled tasks All role projects have a…
16
votes
3 answers

Could not load file or assembly log4net

I have added log4net to my project and it is working just fine on my machine, but when I sent the release version of my application to my colleague, he receives this FileNotFoundException: Could not load file or assembly 'log4net,…
disasterkid
  • 6,948
  • 25
  • 94
  • 179
16
votes
5 answers

Android - How to get Uri from raw file?

I am trying to get the Uri from a raw file I have included in the project in the raw folder. But I am getting a FileNotFoundException, no matter what. The file is a .wav file, also tried it with a .mp4, also doesn't work. Playing both files with…
DijkeMark
  • 1,284
  • 5
  • 19
  • 41
15
votes
5 answers

Catching java exceptions FileNotFound and IOException at the same time

Is the FileNotFoundException somehow a "sub-exception" of the IOException? This is my code opening an input stream to a file at the given path: method(){ FileInputStream fs; try { fs = new FileInputStream(path); …
xrdty
  • 886
  • 2
  • 10
  • 22
14
votes
4 answers

Android Kotlin: Getting a FileNotFoundException with filename chosen from file picker?

I'm working on an Android application where one of the features is to let the user choose a file to open (I'm wanting to open a plain text .txt file). I've worked on Android apps before with Java, but for this one, I'm using Kotlin, and it's my…
CalicoSkies
  • 331
  • 1
  • 3
  • 15