Discussions
Categories
- 385.5K All Categories
- 5.1K Data
- 2.5K Big Data Appliance
- 2.5K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Problem with FileNotFoundException

803077
Member Posts: 9
Hi. Sometimes in my application i have problems with FileNotFoundException, but file which i want to open exists. In the documentation I found that:"It will also be thrown by these constructors if the file does exist but for some reason is inaccessible, for example when an attempt is made to open a read-only file for writing." What can be another reason that the file is inaccessible?
Answers
-
File can be corrupt, it can be locked by another application, the windows system is blocking your access for a host of reasons--the least of which is that something else has used it in the past few minutes and windows thinks it is still in use.
-
File can be corruptThat will not throw a FileNotFoundException.it can be locked by another applicationThat will throw a FileNotFoundExceptionthe windows system is blocking your access for a host of reasonsThat's the general case of the previous special case.the least of which is that something else has used it in the past few minutes and windows thinks it is still in use.That doesn't happen unless the file is currently in use, which you have already covered above.
-
EJP wrote:I would have to dissagree with you there. Not frequently, but on occasioin, I have had windows just not release a lock that is has on a file. I've had this happen with various editors--Word and Notepad are ones that recently come to mind. It has also happened to me doing a copy from one folder to another. Windows Media Player has also expressed a problem and also Excel and Access. I have had these problems in Windows 7, XP, and other previous Windows versions. And please do not think this is limited to accessing a file with Java--it has expressed in various MS development tools and even just using MS products--no programming outside of the shrink wrap MS product was used.
That doesn't happen unless the file is currently in use ...
This discussion has been closed.