Questions tagged [file-not-found]

An error, exit status, or exception that indicates that the file denoted by a specified pathname could not be found.

An error, exit status, or exception that indicates that the file denoted by a specified pathname could not be found. In other words, you're trying to access a file that doesn't exist where the code is expecting it to be.

This could occur as a result of many different actions, such as...

  1. The file doesn't actually exist, or was deleted before you could access it
  2. There is a spelling mistake in your pathname, or the pathname contains characters that aren't permitted in the pathname.
  3. You're using a relative pathname (such as file.txt) and the file doesn't exist in the default working directory for your application
  4. The code is getting confused due to different directory path indicators on different operating systems (ie / vs \)
  5. The programming language interprets the \ character in a String to be a escape character for a special symbol (such as \n indicating new-line), and you're using single \ slashes as directory indicators instead of \\ for a single escaped slash.
  6. In some languages, it could also give this exception if you aren't able to access the file due to security permissions.

Your code should be able to prevent or handle this condition, such as by doing the following...

  1. Detect - Many programming languages allow you to create a File object as a virtual representation of a physical file. Further to this, you can usually call a method or function that asks whether the file exists, such as exists();. This would allow you to check the file exists before you attempt to access it
  2. Prevent - If the user is selecting a file, present them with a FileChooser dialog rather than a text entry field. FileChooser dialogs echo the files that exist in the system, so spelling mistakes are avoided. If you're using relative paths, convert them to absolute paths if practical, or ensure you set the relative path location to a known directory before trying to access files relatively.
  3. Handle - Wrap your file access methods in exception-handling code, such as a try-catch block. This will allow you to catch unexpected exceptions, and perform an alternate operation, such as alerting the user of the error.
601 questions
0
votes
0 answers

Service account Google oAuth: file_get_contents .p12 failed to open stream: No such file or directory

I am trying to run Google oAuth Service Account by specifying keyfilelocation as below: $client_id = 'xccsssds-ib5c5qmr7n34aifss95ue7qouplh7v3r.apps.googleusercontent.com'; //Client ID $service_account_name =…
Sekhar Babu
  • 368
  • 2
  • 8
  • 27
0
votes
1 answer

MCISendCommand Can't find file, but Fstream can so I know it exists, why?

I'm trying to play a midi file using MCISendCommand but I keep getting a DWORD error code 275 (File Not found). I have since placed the relevant code inside a fstream open call which DOES find the file. I then close the file to allow the…
0
votes
1 answer

ASP.NET MVC Database not being created/uploaded System.ComponentModel.Win32Exception: The system cannot find the file specified

Background I have just created an MVC website (as an application) using Visual Studio 2013 Express for Web from the default MVC template using the "Individual user accounts" option. I have created views to fit and added two fields ("Username" and…
0
votes
2 answers

Nginx location: 403 error / File not found

I set up my domain on my server using nginx. So far so good my homepage works. But now I wanna add some locations for later test of programming. My plan is to call diffrent projects like mydomain.com/php/myprogramm.php So I add some folder in …
0
votes
2 answers

Java swing app can't find image

I'm making a torpedo game for school in java with swing gui, please see the zipped source HERE. I use custom button icons and mouse cursors of images stored in the /bin/resource/graphics/default folder's subfolders, where the root folder is the…
KáGé
  • 823
  • 2
  • 12
  • 23
0
votes
1 answer

githash.h: No such file or directory

I am installing Nxtrim (https://github.com/sequencing/NxTrim). However, after typing "make", I am getting following error: make g++ -O3 -I/galaxy/home/biomonika/boost_1_56_0/include mergeReads.cpp fastqlib.o utilityfunc.o -o mergeReads …
Perlnika
  • 4,796
  • 8
  • 36
  • 47
0
votes
1 answer

Getting error (800A0035) referencing a line of code that has already been executed

I am writing a script right now which makes use of the File System Object to read a text file and later delete it. The part of the code in which this occurs I have written as a function. I have tested this function, along with some other functions…
Adam Harvey
  • 55
  • 1
  • 2
  • 10
0
votes
1 answer

CreateProcess fails to run batch file with error code 2

I am creating a child process which executes a batch file success = CodebenderccAPI::CreateProcess( NULL, (LPWSTR)command.c_str(), // command line NULL, // process security attributes NULL, …
KoKa
  • 797
  • 1
  • 14
  • 31
0
votes
2 answers

Websphere logs report {0} File not found, but application continues to work without issues

A websphere 6.1 server is running a struts application that seems to be working fine. In the logs, however, I'm seeing the following error message, which is being continually emailed to the support staff. [3/16/10 15:42:08:089 CDT] 00000023…
Eric the Red
  • 5,364
  • 11
  • 49
  • 63
0
votes
0 answers

Not Found Error On Ajax call to PHP

im having this problem. I'm making a HTML file that has an Ajax Call on it, but when i make the call the error i get is a 404 Not Found Error. But when i go to the path that is inside the call i get the result of the PHP file without any…
Sebastian Hernandez
  • 2,257
  • 4
  • 23
  • 32
0
votes
1 answer

php-version/index.php was not found on this server

i have an ubuntu installation and a folder in my /var/www named site1 with files in it(including index.php and others) but when i try to visit this site by typing localhost/site1 i get the error that says: The requested URL…
infocs
  • 11
  • 2
0
votes
1 answer

Unable to call a PHP file using $.post() method of Ajax

I am trying to call php file located in the same directory as HTML using $.post() method of Ajax. however, i am getting a file not found(404) error. below is the code I am using. $(document).ready(function(){ …
Tejaswi
  • 33
  • 1
  • 8
0
votes
1 answer

Websphere file not found error

I'm a beginner in Java. I have developed a jsp page that accepts the username and password and then a java page is executed that validates against a hardcoded value. The issue is that it runs fine on Tomcat. The webpage displays the message from the…
Navin Kumar
  • 3
  • 1
  • 8
0
votes
1 answer

How to render module view files of laravel 4

I have a laravel 4.1 project with modular system. Here is the tree…
Onur
  • 414
  • 1
  • 11
  • 31
0
votes
1 answer

File Cannot Be Found in Android App

I'm working on an android application that serves as a roll book and I created the StudentStore class that does all the loading and saving of a custom list to the file. My problem is that the file is not created in the sdCard; I've tried a few…