java 如何在java中更改缓存目录的路径,或者如何为任何用户自定义它?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16189833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:09:39  来源:igfitidea点击:

How to change the path of the cache directory in java ,or how to customize it for any user?

java

提问by Yogesh Patil

I want to change the path of : C:\Documents and Settings\abc\Application Data\Sun\Java\Deployment\cacheto any specified Location

我想将 : 的路径更改C:\Documents and Settings\abc\Application Data\Sun\Java\Deployment\cache为任何指定的位置

How to customize deployment.properties file but the changes should be generic to any user,i dont need to to it for every user.

如何自定义 deployment.properties 文件,但更改应该对任何用户都是通用的,我不需要对每个用户都这样做。

Is there any way to do it??

有什么办法吗??

回答by MaVRoSCy

The default java cache directory can be changed from within your windows interface by:

可以通过以下方式从 Windows 界面中更改默认的 java 缓存目录:

control panel>Java > General > Setting > Location

control panel>Java > General > Setting > Location

That's the general location of java cached files.

这是java缓存文件的一般位置。

Note: if the Change button is disabled, go to your JRE>bindirectory and change the javacpl.exeto run in compatibility mode (Windows XP (Service Pack 3))

注意:如果更改按钮被禁用,请转到您的JRE>bin目录并将其更改为 javacpl.exe以兼容模式运行 ( Windows XP (Service Pack 3))

Now if you are using java WebStart as your deployment tool, please refer to this linkand change the deployment.user.cachedirproperty in deployment.properties.

现在,如果你使用的是Java在webstart作为部署工具,请参阅本链接,改变deployment.user.cachedir物业deployment.properties

There is a deployment.propertiesfile for every java installation. In my java configuration the location of this file is C:\Users\<username>\AppData\LocalLow\Sun\Java\Deployment.

deployment.properties每个java安装都有一个文件。在我的 java 配置中,这个文件的位置是C:\Users\<username>\AppData\LocalLow\Sun\Java\Deployment.

Refer also to how to change Java cache folder automatically for WebStart programs

另请参阅如何为 WebStart 程序自动更改 Java 缓存文件夹