a file can't be opened in eclipse -
i can't figure out why can't open file located @ correct place in file tree.
**java.io.filenotfoundexception: wages.xls ** @ line :
fileinputstream file = new fileinputstream("wages.xls");
.
probably build path error in eclipse
you need add file folder located in classpath, named resources
. can access content of file through classloader
of classes :
class test { public static void main(string[] args) { inputstream myfilecontent = test.class.getresourceasstream("/directory/file"); } }
this work project following file tree :
- projectroot
- src
- test.java
- resources
- directory
- file
- directory
- src
and classpath including both src
, resources
directories.
Comments
Post a Comment