开发者

find java cache directory - dynamically

Is there some way how to find the java cache directory programatically?

Normaly it is located in directory like this:

System.getProperty("user.home") + someMiddleDir + "/Sun/Java/Deployment/cache/" +
    versionCode;

which resolves on Windows Vista into "c:/Users/userId/AppData/LocalLow/Sun/Java/Deploym开发者_如何学运维ent/cache/6.0"

But I would need to find it in some more dynamic/precise way (minimum hardcoded code/path).


use this:

com.sun.deploy.config.Config.getCacheDirectory()

one good friend told me about this little nasty method :)


A more general solution is to read the system property deployment.user.cachedir. I tested this with Java 8 and 9, both work in my case.

System.getProperty("deployment.user.cachedir")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜