JAR file paths
I have some classes and text files in the same directory contained in a package. I ultimately want to run my program from a jar but right now I cannot seem to access the text files from inside the package.
My classes can't find the text files when I use FileReader even though they are in the same directory. I am not sure what I can do to fix the path issue. Can someone help me?
If the text files will be in the Jar file, then don't access them as files but rather as resources. I'm not sure where in the tutorials this is found, but if you search the Sun Java tutorials you'll find a section on this.
With the same result, null pointer.
InputStream b = FileIO.class.getClass().getResourceAsStream(fileName);
//FileReader a = new FileReader(getPath(fileName));
InputStreamReader a = new InputStreamReader(b);
Where is the data file located in relation to the class files?
The classes are in the same package/same directory.
Not the classes -- where is the data file?
This is what the jar looks like:
I am trying to access the text files from TestDriver