I have tried the methods posted in related threads (getting protected domain, etc) but when the Jar is run in SuSE Linux Enterprise Server 10, the string returned is just a dot (.) denoting current working directory.
I have a jar that requires native libraries to grab system information on servers that are already running java apps for production (so I don't believe I can mess with java.library.path without bad things happening).
I'm hoping I can discover the path of the running jar, so that I can use that string to form a System.load("my/path/to/native/libs") statement, as I know this works. Attempts to use System.loadLibrary for relative path have failed - the native libraries are in the root directory of the java app I'm deploying.
Here is one of the methods I have attempted from the other thread:
File fl = new File(SystemInfoGrabber.class.getProtectionDomain().getCodeSource().getLocation().getPath());
System.out.println(fl.getPath());
This returns a period (.) in SuSE