hi, i need to know how i can retrieve the full path the program has been started form. i'm searching for something like "getmyroot()" so that i can open a file i'm distributing with the program (just "file.txt" is not enough). thanks for helping, yours, martin
I answered this already, but I don't know if it was in another forum, or if a UBB error threw my answer out. Excuse me if I'm repeating myself. Use Class.getResourceAsStream() to open a file that's "near" a .class file. For example, if Foo.class and data.txt are supposed to be in the same directory (either in a JAR file, or separately on disk) then InputStream is = Foo.class.getResourceAsStream("data.txt"); gives you a stream through which you can read data.txt.