View Full Version : Java: How can I reference a file to read?

November 8th, 2010, 08:49 PM
I want to store a data file within a package in a Java file to later read. I can load in the specific file from my desktop just fine, but what i want to do is be able to have the file stored in with the java file and be able to access it by telling it to look in the same directory the java file is in.

in short, i want to be able to read in a file but move the file and the code to say a new environment (ie Windows to Linux) and not have to change the code.

Some Penguin
November 8th, 2010, 09:17 PM