Use the classloader:
InputStream stream =
getClass().
getResourceAsStream("yourfile.txt");
or if running from a static method:
InputStream stream =
YourClass.class.
getResourceAsStream("yourfile.txt");
You can then put that InputStream in a Scanner to do whatever you like:
Scanner scanner = new Scanner(stream);
(Note: deonejuan's code doesn't work. First of all, he never opens the file, so you'd get a NullPointerException when you attempt to open the Scanner. Also, you can't use a FileReader like he was attempting to do in his commented out code. A file inside a jar is not a "File", it is a jar element and you'd get a FileNotFoundException.
If you want to open a file that was located via getResource(), you'd do this:
URL url = getClass().getResource("blah.txt");
InputStream stream = url.openStream();
Scanner scanner = new Scanner(stream);
)