Note that there are some explanatory texts on larger screens.

plurals
  1. POFileNotFoundException when file exists with all permissions
    text
    copied!<p>I am trying to read a file and the error i get is </p> <pre><code>java.io.FileNotFoundException: /homes/at1106/fourthYearComputing/Individual-Project/svn-workspace/trunk/Individual_Project/src/game/player/gametheoryagent/configurations/gameTheoryAgentConfiguration.properties (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:106) at game.player.gametheoryagent.GameTheoryAgent.&lt;init&gt;(GameTheoryAgent.java:67) at simulation.Simulator.createPlayer(Simulator.java:141) at simulation.Simulator.main(Simulator.java:64) </code></pre> <p>however the file does exist and just to double check i gave it 777 permissions, as shown below:</p> <pre><code>tui% cd /homes/at1106/fourthYearComputing/Individual-Project/svn-workspace/trunk/Individual_Project/src/game/player/gametheoryagent/configurations tui% ls -al total 4 drwxrwxrwx 3 at1106 cs4 1024 2010-02-22 17:45 . drwxrwxrwx 4 at1106 cs4 1024 2010-02-22 17:27 .. -rwxrwxrwx 1 at1106 cs4 260 2010-02-22 17:31 gameTheoryAgentConfiguration.properties drwxrwxrwx 6 at1106 cs4 1024 2010-02-22 17:41 .svn </code></pre> <p>Any ideas as to why I'm getting the FNF exception?</p> <p>Thanks</p> <p>java code that makes the call:</p> <pre><code>File file = new File(pathToConfiguration) Properties configuration = new Properties(); try{ configuration.load(new FileInputStream(file)); int RAISE_RATIO = Integer.parseInt(configuration.getProperty("raise_ratio")); } catch(IOException event){ System.err.println("Error in reading configuration file " + pathToConfiguration); event.printStackTrace(); } </code></pre> <p>The properties file reads:</p> <pre><code>raise_ratio=4 </code></pre> <p>This was tested in windows (with a diff pathToConfiguration (which is passed into the constructor)) and works fine.</p> <p>Added in the following checks in the Catch block</p> <pre><code> if(file.exists()){ System.out.println("file exists"); } else{ System.out.println("file doesn't exist"); } System.out.println(file.getAbsolutePath()); if(file.canRead()){ System.out.println("can read"); } if(file.canWrite()){ System.out.println("can write"); } </code></pre> <p>the output is as follows:</p> <pre><code>file doesn't exist /homes/at1106/fourthYearComputing/Individual-Project/svn-workspace/trunk/Individual_Project/src/game/player/gametheoryagent/configurations/gameTheoryAgentConfiguration.properties </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload