Hi everybody,
First off, thanks again to everyone who helped me with my hardcoding ArrayList problem. I'm trying to read my file in as a resource, but for some reason it doesn't seem to work. I have my text file side-by-side with the classes in my Java package (called "viewer"), like some of the other posts on this forum said, but my code keeps returning my inputStream as null. My code is:
InputStream is = this.getClass().getClassLoader().getResourceAsStream( "file.txt" );
BufferedReader reader = new BufferedReader( new InputStreamReader( is ) );
The error keeps getting thrown as a null pointer exception on that second line of code. Can anyone tell me what I'm doing wrong?
Thanks,
Jezzica85