nullpointerexception - NPE when loading a file in Java -
i'm trying load file parser class i've written keep getting npe on following line. i've changed file path around doesn't help. location of dataset.csv file src/res/raw
file location defined as:
private static final string file = "/res/raw/dataset.csv"; file file = new file(this.getclass().getresource(file).getfile()); the line above keeps throwing npe
resources not files, or files. inside jar file example.
you should use uri returned this.getclass().getresource(file), or inputstream returned this.getclass().getresourceasstream(file), directly.
Comments
Post a Comment