I always thought that System.getProperty("user.dir") was sufficient to
locate the directory of the "program", meaning that if i wanted to
write something to the directory where the jar file is i would just
need to get it.

Not so, that property gets the location where the java command was
invoked, and thus is completly useless for that that.
I'd like to propose two new properties: program.home and program.directory.

I can mangle it right now parsing the classpath like so:
String s = System.getProperty(java.class.path).split(File.pathSeparator)[0];
int i = s.getLastIndexOf(File.separator);
s = s.subString(0, i);

Still - annoying.

Reply via email to