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

java.io.FileNotFoundException for a present MultipartFile

I am dealing with a strange behaviour regarding a MultipartFile. My project is a Spring Boot backend that receives a text file. This text file comes in as a MultipartFile. I than want to send this file to a secondary Spring Boot backend which shall…
5
votes
2 answers

Android - Saving a downloaded image from URL onto SD card

I am loading an image from an URL on button click, and storing it as a Bitmap. Now i want to know how to save that downloaded image into sd card as well as in system. I attempted to do it the following way: package com.v3.thread.fetchImage; import…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
5
votes
1 answer

BitmapUtils throwing FileNotFoundException on foldername having space while getting bitmap from uri

Getting FileNotFoundException on folders having space on Android 5.1. Otherwise its working fine. I tried replacing space with %20 but din't work. Also tried URLEncoder but it's failing. I'm getting path of image using…
AskQ
  • 4,215
  • 7
  • 34
  • 61
5
votes
3 answers

File not Found Exception occurs when accessing flutter assets

i am trying to write a plugin to play audio files that are stored in assets folder of flutter package and have done like this if(call.method.equals("playMusic")) { Log.d(TAG, "onMethodCall: play music function called"); String fileLocation…
Ganesh Tiwari
  • 176
  • 2
  • 17
5
votes
1 answer

Android - open txt file from Intent Chooser

by click on some button - an intent for selecting txt file is created: Intent intent = new Intent() .setType("text/plain") .setAction(Intent.ACTION_GET_CONTENT); …
5
votes
1 answer

How to remove file path encoding %20 in java

I am tring to create a xml file in a specific path using java. Problem is if I give file path with space it is encoding with '%20' in the blank spaces. Kindly help me to solve this issue. File path given by me - "F:/Backup…
Karthik
  • 113
  • 2
  • 15
5
votes
2 answers

java.io.FileNotFoundException: /storage/emulated/0/

I am trying to create a .txt file through my app in android studio. SDK version 10, my emulator is galaxy S7 (I am not sure if this matters at all). I have written the following class and it keeps on giving me file no exception error. I have googled…
Ankit Agarwal
  • 111
  • 1
  • 1
  • 4
5
votes
3 answers

Getting java.io.FileNotFoundException when using VideoView

I have the following code: VideoView videoView = (VideoView)findViewById(R.id.instructionsvideo); assert videoView != null; videoView.setVideoPath("android.resource://" + getPackageName() + R.raw.testnatureclip); …
Foobar
  • 7,458
  • 16
  • 81
  • 161
5
votes
1 answer

FileNotFoundException while watching variables in debug mode

I have this piece of code (well I have the issue everywhere) When I debug this, break in the funcion, try to watch some variables. And I keep getting a FileNotFoundException public void PayrollActivityCodeTest() { using(var pr = new…
poudigne
  • 1,694
  • 3
  • 17
  • 40
5
votes
2 answers

Spring MVC Multipart file upload random FileNotFoundException

I built a web application using spring MVC, everything is working fine except the file upload in which I got random FileNotFoundExceptions. I found some solutions online like using a different tmp folder but I keep getting random error. My code is:…
phcaze
  • 1,707
  • 5
  • 27
  • 58
5
votes
1 answer

FileNotFoundException thrown for a referenced assembly

I'm getting a really weird FileNotFoundException thrown the first time I try to use a class defined in an assembly I have referenced. The assembly hasn't changed, and the location in the project file corresponds correctly to the physical path on…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
5
votes
3 answers

Android Reading a Text File

I am making a project in Android Studio, I have a text file in my project folder, each time I compile, I want my code to read that .txt file. When everythings finished, I want that .txt file to be inside .apk file. I am not trying to read from SD…
berkc
  • 525
  • 3
  • 9
  • 21
5
votes
3 answers

java.io.FileNotFoundException: while accessing REST service

I'm trying to access a web service through REST API post method and end up with FileNotFoundException code: public class TestService { static { disableSSLVerification(); } public static void main(String[] args) { …
Nani
  • 1,148
  • 3
  • 20
  • 35
5
votes
2 answers

Why I obtain this FileNotFoundException when I try to use log4j to write into a file?

I am absolutly new using log4j and I have the following problem. I am trying to print the logging line into a file named log.out. So I create the following log4j.properties configuration file: # Define the root logger with appender…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
5
votes
2 answers

FileNotFoundException when submitting to Spark Cluster

I've created a small application using Apache Spark, when I run the application locally everything runs fine. But when I submit it to a 6-node cluster I get a FileNotFoundException, because he can't find the input file. This is my tiny…