title: Access files stored on server with Tomcat webapp
body: <p>I currently have a GWT webapp running on an Ubuntu 11.04 server with Tomcat6.  The app needs to be able to read and write to files from a specific folder on the server.  When running the app in dev mode through Eclipse (using the built in jetty instance, I suppose), it works fine. However, when I deploy the app to the Tomcat server, the app is unable to read/write the files.  </p>
  
  <p>What's the proper path structure to point to the correct folder on the server?  I.e. how would I tell the app to access the /home/username/project folder?</p>
  
  <p>Is there a configuration setting that I need to make for Tomcat to allow accessing files?  </p>
  
  <p>Here's how I'm currently retrieving the file (where String file = "./projects/filename"):</p>
  
  <pre><code>public Project getProjectFromFile(String file) {
      Project p = null;
      try {       
          InputStream fis = getResourceAsStream(file);
              FileInputStream fis = new FileInputStream(file);
              ObjectInputStream ois = new ObjectInputStream(fis);
  
              p = (Project) ois.readObject();
  
              ois.close();
      } catch (FileNotFoundException e) {
          System.err.println("getProjectFromFile FileNotFoundException: "
                  + e.getMessage());          
      } catch (IOException e) {           
          System.err.println("getProjectFromFile IOException: " + e.getMessage());        
      } catch (ClassNotFoundException e) {            
          System.err.println("getProjectFromFile ClassNotFoundException: " 
                  + e.getMessage());          
      } catch (Exception e) {         
          System.err.println("getProjectFromFile Exception: " + e.getMessage());
          e.printStackTrace();
      }
  return p;
  }
  </code></pre>
  
  <p>I'm also open to suggestions to any suggestions.  Thanks</p>