Note that there are some explanatory texts on larger screens.

plurals
  1. POFile not found exception, snippet works flawlessly in other projects
    text
    copied!<p>This following scippet works well, and I have been using it across many projects. However, for this one project, I get a file not found exception.</p> <pre><code>try { FileInputStream is = new FileInputStream(file); String original = file.getName(); Logger.debug("Filename in upload pf %s ", original); IOUtils.copy(is, new FileOutputStream(Play.getFile(original))); PfParser p1 = new PfParser(); p1.read(original, month, year); Payroll.index(); } catch (FileNotFoundException e) { Logger.error(e, "Exception in uploadSheet: "); e.printStackTrace(); } catch (IOException e) { Logger.error(e, "Exception in uploadSheet: "); e.printStackTrace(); } </code></pre> <p>This is the read method, where I have tried a few combinations, which are commented out:</p> <pre><code>FileInputStream myInput = new FileInputStream( System.getProperty("user.dir") + inputFile); w = Workbook.getWorkbook(myInput); // w = Workbook.getWorkbook(new File(inputFile)); // w = Workbook.getWorkbook(new File(System.getProperty("user.dir"), // inputFile)); </code></pre> <p>This uploads the file to the <code>C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\application</code> folder.</p> <p>I am trying to read an excel file using Jexcel. The error I get on my server:</p> <pre><code>java.io.FileNotFoundException: foo.xls (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) </code></pre> <p>Trying the other (commented out) lines, only gives a variation in the error. </p> <pre><code>java.io.FileNotFoundException: C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\foo.xls (The system cannot find the file specified) </code></pre> <p>I understand its a problem related with absolute and relative paths, but cant seem to find a solution. I do not get any errors, while coding and testing on my local machine which is Ubuntu. Its only when I deploy to a Windows server, do I get these problems.</p> <p>Thanks.</p>
 

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