Using FileReader causes a compiler error “unhandled exception type FileNotFoundException”

后端 未结 6 1060
傲寒
傲寒 2021-01-15 10:01

Ive read a few threads here that relate the same problem, but the solutions arent working. :/

I use Eclipse, here is my program.

package mypackage;
         


        
6条回答
  •  难免孤独
    2021-01-15 10:35

    You are expecting Eclipse to run the program in the project root directory. Unless you did something special with your "Run" configuration, I'd be suprised if it really starts there.

    Try printing out your current working directory to make sure this is the right path.

    Then try verifying that the bin / build directory contains your "*.abc" files, as they are not Java source files and may have not been copied into the compilation output directory.

    Assuming that they are in the compliation directory, rewrite your file loader to use a relative path based on the class laoder's path. This will work well in exanded collections of .class files in directories (and later in packed JAR files).

提交回复
热议问题