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
11
votes
3 answers

java.io.FileNotFoundException: (No such file or directory) when running from eclipse

I am writing to a file and want console output, // TODO Create a game engine and call the runGame() method public static void main(String[] args) throws Exception { NewGame myGame = new TheGame().new NewGame(); myGame.runGame(); …
user2644085
  • 157
  • 1
  • 2
  • 9
10
votes
6 answers

Managing assets between desktop and device version in libgdx

I'm building a little Android game using libgdx. For now I have a copy of the game's assets in the desktop project folder and the Android project folder. For some strange reason I have to access those files differently in each of the two…
Boris
  • 8,551
  • 25
  • 67
  • 120
10
votes
2 answers

"module could not be found" error with C++/CLI component in ASP.NET

I have to include a (managed) C++/CLI component in one of my ASP.NET projects, that references for itself some other (unmanaged) C++ DLLs. Should be no problem - .NET 3.5 is happy when compiling the project, everything seems fine. The C++/CLI…
Matthias
  • 3,403
  • 8
  • 37
  • 50
10
votes
3 answers

FileNotFoundException when Deserializing XML

We've recently starting seeing FileNotFoundException's being thrown sporadically while deserializing XML. The message is that the temporary assembly used to map from the XML to code can't be found. From this document it looks like this can happen…
Loathian
  • 1,177
  • 1
  • 14
  • 20
10
votes
3 answers

BitmapFactory: Unable to decode stream: java.io.FileNotFoundException

I have a problem concerning the BitMapFactory.decodeFile. In my app, I want to user to be able to select an image from his/her device or take a photograph. This must then be displayed in an ImageView Here is code snippet: Uri selectedImage =…
Monali
  • 270
  • 1
  • 5
  • 16
10
votes
4 answers

FileNotFoundException when file exists with all permissions

I am trying to read a file and the error i get is java.io.FileNotFoundException:…
Aly
  • 15,865
  • 47
  • 119
  • 191
10
votes
5 answers

java.io.FileNotFoundException in eclipse

Code: import java.io.*; import java.util.Scanner; public class Driver { private int colorStrength; private String color; public static void main(String[] args) throws IOException { String line, file = "strength.txt"; …
DTRobertson94
  • 201
  • 1
  • 3
  • 13
10
votes
3 answers

read/write an object to file

here is the code : my mission is to serialize an my object(Person) , save it in a file in android(privately), read the file later,(i will get a byte array), and deserialize the byta array. public void setup() { byte[] data =…
harveyslash
  • 5,906
  • 12
  • 58
  • 111
10
votes
3 answers

What does and (Native Method) mean?

What do the symbols indicate and what does the (Native method) say about the java.io.FileStream.open method? Exception in thread "main" java.io.FileNotFoundException: line23 (No such file or directory) at java.io.FileInputStream.open(Native…
sadfrogger
  • 105
  • 1
  • 8
9
votes
8 answers

"Could not load file or assembly 'XXX.YYY' or one of its dependencies. The system cannot find the file specified."

I have a .net visual studio solution with a number of projects (class libraries and a web application). I did some refractoring which moved files between projects, created new projects, deleted ones not being used and renamed some existing…
amateur
  • 43,371
  • 65
  • 192
  • 320
9
votes
4 answers

Deploying NetFwTypeLib to manage the Windows Firewall

My Windows service needs to create/remove certain rules from the Windows firewall. For this I interface with NetFwTypeLib in \system32\hnetcfg.dll via COM. It works great on my 64-bit Windows 7 machine, but testing on another 64-bit Windows…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
8
votes
4 answers

VirtualFileResult file not found when file exists

Maybe I'm not understanding what a VirtualFileResult is, but I'm not sure why it's throwing a FileNotFoundException when the file exists. Here's the code: if (System.IO.File.Exists(fileName)) { FileInfo info = new FileInfo(fileName); return…
painiyff
  • 2,519
  • 6
  • 21
  • 29
8
votes
4 answers

Can't Access Resources In Executable Jar

Can someone please point out what I'm doing wrong here. I have a small weather app that generates and sends an HTML email. With my code below, everything works fine when I run it from Eclipse. My email gets generated, it's able to access my image…
Chiefwarpaint
  • 643
  • 2
  • 12
  • 25
8
votes
1 answer

System.IO.FileNotFoundException. Where do I find what path is wrong?

I create small Windows Forms progs in VisualStudio2010, just for hobby. After releasing them I use the .exe file to run them on other PCs, without having to do any installation. Those PCs run Windows OS(7,vista,XP). The PC which I wrote the code…
Stelios
  • 161
  • 1
  • 4
8
votes
2 answers

Java unzip compressed archive with folders FileNotFound exception

I am trying to unzip an archive in java that contains folders as well as files inside of the archive. The issue is that it throws a FNF exception whenever it gets to the folders and tries to unzip them. My unzip code is as follows: private void…
Giardino
  • 1,367
  • 3
  • 10
  • 30