72
71 Gah! Would by chance anyone here know how to make user independent external jar paths in eclipse?
You mean so you can read to and write from files, if the jar/class file isn't on your hard drive in precisely the location where Eclipse puts it?
Just use relative file paths. If you want to open a file called stuff.txt in the same directory as the jar or class file, wherever that may be, simply do new File("stuff.txt"). If you want to go into a directory inside the one where the jar is located, do new File("whateverDirectory/stuff.txt"). In addition, every directory has two special directories inside it, named . ('dot') and .. ('dot dot'). Dot is the current directory (in case you need to do something with the current directory, for whatever reason), and dot dot is the
parent directory. So, if your installer puts the jar file in a directory called bin, and puts config files in a folder next to bin called config, you can get to config files with new File("../config/stuff.cfg").
This isn't limited to Java, by the way. You should
always use relative file paths in all code everywhere, unless you want to access something in a completely different part of the file system (e.g. /bin/bash or /dev/null, or C:\\Program Files for you Windows newbs). If "/usr/duckfan/documents/code/java/some_project/config/derp.txt" shows up in your code, you're doing it wrong.