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
0
votes
2 answers

could not load file or assembly 'gtk-sharp version=2.12.0.0'

Trying to run a GTK GUI test app and get "could not load file or assembly 'gtk-sharp version=2.12.0.0" but i have gtk+-2.0 ver 2.24.10 installed. how do i work around this please. Thanks.
ckglobalroaming
  • 267
  • 3
  • 10
0
votes
1 answer

Non-catchable FileNotFoundException when using XmlReader.Create

I am currently designing a program where a string array saves every time a button is pushed and loads at the start of the program. I have two issues: one, when trying to load the file, it hits the using statement and it gives me the exception of…
user3439632
  • 55
  • 1
  • 6
0
votes
0 answers

Android: Could not read image from disk and use them in a Imageview

I downloaded an image to the following target: String Target = Environment.getExternalStorageDirectory()+"Test.png" At my smartphone, the file is located in (AFAIK) /storage/emulated0/Test.png. Now, I want to read this file and load them into a…
0
votes
2 answers

Java Finding a file in /res folder and using Scanner with it

My File is located in my /res, more specifically its in /res/Menus/CharSelect. I have already gone into my build path and made sure the res folder is a class path. However, my new Scanner(file) is causing a NullPointerException. When I do…
Evan Nudd
  • 216
  • 2
  • 10
0
votes
1 answer

Successfully write to a file in Eclipse ADK, but cannot read from it

I'm developing an app for Android, and I've run into a problem. Using the following 2 objects I have successfully written data to a file. I've checked this using the android file explorer. FileOutputStream outFile = openFileOutput("myfile.dat",…
DeepDeadpool
  • 1,441
  • 12
  • 36
0
votes
0 answers

URL, Bitmap resource prepended with slash(/)

i tried to populate a ListView using SimpleAdapter, and for String values, my coding works fine. ... ListView lv = (ListView)findViewById(R.id.list_jobs); data = new ArrayList(); String[] from = {"job_postitle", "job_company", "job_location",…
sanusi
  • 739
  • 7
  • 10
0
votes
3 answers

receiving FileNotFoundException even though throws statement is present

I have written the following code that prints a list of randomly generated characters to a file, then reads them from a file, encrypts them using an exclusive or, and then prints them again. The issue is that I am receiving a FileNotFoundException…
user2993456
0
votes
4 answers

FileNotFoundException with Java using Eclipse

I am using Eclipse and am in the early stages of learning Java Busy learning how to read data from a txt file but can't for the life of me get Java to read the my source file Here is my code import java.io.FileReader; import…
ocajian
  • 667
  • 5
  • 13
  • 29
0
votes
1 answer

How to use Velocity template inside java class

I am trying to use a velocity template inside java class below is my code VelocityEngine ve = new VelocityEngine(); ve.init(); VelocityContext context = new VelocityContext(); context.put("object", someobject); Template t =…
oortcloud_domicile
  • 840
  • 6
  • 21
  • 41
0
votes
2 answers

Eclipse, Unable to Read Text File in Java Class

I know that some people have already encountered this problem, but I am still unable to solve it. Here is my code: import java.io.*; public class MainClass { public static void main( String[] args ) { BufferedReader br = new…
Pippo
  • 1,543
  • 3
  • 21
  • 40
0
votes
0 answers

FileInputStream causing FileNotFoundException - The Process cannot access the file

I am using the Watcher Service to let me watch for the addition or removal of files from a particular directory. So far I have it working for adding the file and deleting the file. What I am seeing however is a stacktrace…
Dan
  • 979
  • 1
  • 8
  • 29
0
votes
0 answers

Access Denied even on Signed Jar

I am using Applet and jar signer to sign the jar file ,but still getting error ,my java version is 51 hiiiii java.io.FileNotFoundException: D:\dest (Access is denied) at java.io.FileInputStream.open(Native Method) at…
siddharth gupta
  • 306
  • 1
  • 11
0
votes
1 answer

Mallet SimpleTagger FileNotFoundException: c:\mallet-2.0.7 (Access is denied)

I tried running Mallet from windows cmd following exactly the examples in the documentation and also from the solution in this post I keep getting this error, what could be the problem? c:\>java -cp…
DevEx
  • 4,337
  • 13
  • 46
  • 68
0
votes
1 answer

Error java.io.FileNotFoundException, read a webpage

I want to read a web page with multiple page, for example: page=1 until 100 import org.htmlcleaner.*; ... url = http://www.webpage.com/search?id=10&page=1 for (int j = 1; j <= 100; j++) { WebParse thp = new WebParse(new URL(url+j)); Sometimes…
enhaka
  • 85
  • 8
0
votes
2 answers

What is the best way to handle an exception for an invalid file?

I have a java class where a user provides a file path and if the path doesn't exist I ask them to try again. My professor says we should use an exception to handle this. Here is a snippet of how I'm currently doing it: public class SalesUtil { …
nullByteMe
  • 6,141
  • 13
  • 62
  • 99