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

Joomla URL The requested URL was not found on this server

When clicking on any links in the administrator dashboard of Joomla I am getting the following error: Not Found The requested URL was not found on this server. Apache Server at site-url Port 80 example path that I am trying to access:…
n_starnes
  • 376
  • 1
  • 6
  • 20
0
votes
1 answer

Build numpy for python3 when python not installed in /usr

Fedora 18, x86_64. Okay, so: I have installed python3 in ~/utils/src/python3/Python-3.3.0/ so that it's available on NFS and I don't have to reinstall it on every machine in the lab. I want to install numpy. I got the source, it's in…
Charles McAnany
  • 195
  • 1
  • 2
  • 7
0
votes
3 answers

Error reading from file

i was doing a sample about reading files. I put a txt file into project folder and wrote this code but I got the exception FileNotFound and also when I try to close dataInputStream I am getting compile error(commented out line). I think I messed up…
digrev
  • 97
  • 1
  • 6
0
votes
1 answer

.c Source file disappeared, any hope?

I was doing some C programming when I wanted to compile and test my program. gcc -g -o main file.c file2.c file3.c ... worked for everything up till then, when suddenly I get a dozen undefined reference error message from gcc. ls and ls -la reveal…
filpa
  • 3,651
  • 8
  • 52
  • 91
0
votes
1 answer

Deploying EJB module using jboss-maven-plugin fails with FileNotFoundException

I'm trying to deploy a jar file containing my EJBs to JBoss 5, using the jboss-maven-plugin. But the plugin can't find my jar file. I'm running the command: mvn jboss:deploy This is what my configuration in my POM.xml looks like:
Henrique Ordine
  • 3,337
  • 4
  • 44
  • 70
0
votes
1 answer

Issue when loading an XNA project at home computer

I have just installed Microsoft Visual Studio 2010 Pro and at school we run the same version but at home I get errors. F:\xna\LearningXNA4.0\Chapter 02\Collision\Collision\Collision\Collision.csproj : error : Unable to read the project file…
0
votes
2 answers

Eclipse (simulator Android tablet) File Not Found even though file exists

I am trying to read a file. I do not mind the location, so I have tried various locations and ways to do this: File file = new File("DFirstPdf.pdf"); File file = new File("C:/DFirstPdf.pdf"); File file = new File("C:\\DFirstPdf.pdf"); But I always…
user2173859
  • 57
  • 10
0
votes
1 answer

Tried to Install Wordpress on Subdomain, Broke Main Domain Links

I have a main portfolio site hosted through MacHighway. My hosting package allows me to have two domains. I thought I'd register a new domain to experiment with some new things. So I bought a new domain, went into my main site's cPanel, registered…
mcography
  • 1,081
  • 6
  • 19
  • 36
0
votes
1 answer

What does ERROR_FILE_NOT_FOUND mean from SendMessage?

SendMessage returning 0 and GetLastError returning 2 (ERROR_FILE_NOT_FOUND). ERROR_ACCESS_DENIED is documented but not this. Anyone have any idea what this means?
cedral
0
votes
2 answers

Connecting to index.php on asterisk server

I am trying to connect to an index.php file located in the directory /var/lib/asterisk/agi-bin/index.php located at my Asterisk server. When I try connect I use /var/lib/asterisk/agi-bin/index.php url, but I get error 404 every time. I have used…
Zuenonentu
  • 302
  • 1
  • 3
  • 16
0
votes
1 answer

mysql Error:13 MyISAM table file not found

I have a set of files (around 20MB each) that needs to be inserted into a table in mysql. The insert is done in a loop for all files (single threaded). This works usually fine, but from time to time I am getting the following exception: File…
dcg
  • 1,144
  • 1
  • 22
  • 38
0
votes
0 answers

FileNotFoundException in android

I have a pice of code, which streams video from server, to flash player which I inserted in my app, but sometimes, after user press "play" due to network problem, it gets an FileNotFoundException. how can i edit my code to try and tray and tray a…
Reza_Rg
  • 3,345
  • 7
  • 32
  • 48
0
votes
3 answers

PhoneGap Upload Error : FILE_NOT_FOUND_ERR (code=1)

I got an error when uploading a file. So, I get a list of files using "fileSystem.root" , and i put my selected file name to a variabel "selected_file". And here is the code: //assume ROOT = fileSystem.root and selected_file = c360_debug.txt var…
Win
  • 33
  • 2
  • 6
0
votes
1 answer

Flex RemoteObject Source not found

Our flex project, which works fine in its current environment with coldfusion 7 single server. We moved this project to Coldfusion 8 multi server, and updated the remoteobject paths relative to the web root. The error we now receive is…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
0
votes
1 answer

Attachments not getting accessed or displayed in wordpress

I have inserted an image here in this post (http://seminartopics.info/uncategorized/test/) and linked it to the same for download or view. Link is http://seminartopics.info/wp-content/uploads/2012/11/paypal.gif But it is not displayed in the post…