Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8655563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:03:45+00:00 2026-06-12T15:03:45+00:00

This following scippet works well, and I have been using it across many projects.

  • 0

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.

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();
    }

This is the read method, where I have tried a few combinations, which are commented out:

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));

This uploads the file to the C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\application folder.

I am trying to read an excel file using Jexcel. The error I get on my server:

java.io.FileNotFoundException: foo.xls (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)

Trying the other (commented out) lines, only gives a variation in the error.

java.io.FileNotFoundException: C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\foo.xls (The system cannot find the file specified)

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.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:03:47+00:00Added an answer on June 12, 2026 at 3:03 pm

    I changed the line from

    IOUtils.copy(is, new FileOutputStream(Play.getFile(original)));

    to

    IOUtils.copy(is, new FileOutputStream("./" + original));

    Upload now works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Never thought I'd have this problem :) The following snippet of code works in
I am using the following code snippet to calculate a total price. This works
I have the following code snippet: using (SPSite site = new SPSite(this.ListAddress)) { using
This following code snippet works fine using jQuery1.2.3, but it doesn’t work with latest
This following code snippet works in FF, IE and Chrome. However It does not
I have been trying all day to get this to work and have been
I have the following snippet of JS var Customer : function() { this.ShipProduct :
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
Can you guys help me figure this out? I have the following JavaScript snippet:
I have this following codes: @implementation MyImageView @synthesize image; //image is a UIImage -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.