I am in need of a way for my program, which is inside a jar, to access a text file outside of the jar. The text file will always reside in the same place as my jar.
Originally posted by Ulf Dittmer: Why can't you use regular file I/O?
I think the problem is that the location of both the JAR file and the text file can change, but they are always located in the same folder. Basically, the JAR location (and therefore the text location) needs to be determined at runtime.
Check out this article at Javaworld; it lists some code that can determine the physical location of a class.