In Ruby I frequently use File.dirname(__FILE__)
to open configuration files and such. For those that don't know Ruby, this will give the location on the file system of the file it's called from. This allows me to package libraries with data and config files and open those files with relative paths.
What's the Java equivalent of this? If there is a data file I want to package with a jar how would I open the data file from Java code that is also in the jar?