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

and classpath including both src , resources directories.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -