Read an Excel file with a java bean

Discussions

General J2EE: Read an Excel file with a java bean

  1. Read an Excel file with a java bean (1 messages)

    Hi all I'm trying to read data from an Excel file by a bean. My bean resides on a tomcat server in the same directory as the .xls file. I'm using POI and java.io. Now this all works well on my local machine (also using the same tomcat server). The problem is that the path that I use to refer to the .xls file is not correct for some reason. Are there special rules when you try to read a file on a server?? I'm using an absolute pad (usr/local/tomcat/........./classes/test.xls thnx in advance
  2. Simply don't use an absolute path. Preferably, put the resource somewhere in the classpath. That way you have a generic solution which will work in any environment. If you don't want to put the xls file amongst your libs, extend your classpath to include a "resource" folder, where you put such data as xls-files. /Niklas