Image

Imageilja_l wrote in Imagejava_dev

problem with FileReader

Could anyone give me a hint what is wrong with this piece of code?
It works just fine in Eclipse, but when I export it to jar, it doesn't see the files, so it must be some path issue. The problem is that I simply can't find the solution.

UPDATE: Thank you, problem solved! I simply used class.getResource() to get the resources inside jar-archive.


    public StreamTokenizer getStreamTokenzer(String fnm) {
        StreamTokenizer st = null;
        try {
            FileReader fr = new FileReader(MAP_DIR + fnm);
            st = new StreamTokenizer(fr);
        } catch (FileNotFoundException e) {
            System.err.println("File " + (MAP_DIR + fnm) + " not found!");
        }
        return st;
    }