How do you find the JAR filename from the running code

I want to be able to load files from an executable JAR file, the best method I have is below. But it requires knowing a class in the JAR which is not a problem. I just want to know if it can be done without knowing a class file in the JAR so I can get rid of the anyfileinjar parameter below.

Thanks

public String getJARPath(String anyfileinjar){

int idx;

String ret = getClass().getResource(anyfileinjar).getPath();

if (ret.startsWith("file:/")){

ret = ret.substring(6);

}

idx = ret.indexOf('!');

if (idx != -1){

ret = ret.substring(0, idx);

}

return ret;

}

[1022 byte] By [digiboy86a] at [2007-11-27 10:44:34]
# 1

You can get all this information through System Properties

tjacobs01a at 2007-7-28 20:07:39 > top of Java-index,Desktop,Deploying...