How to change Cache location for Java on windows 7

One would like to change the cache location of Java, which has a default size limit of 1000MB, to save space on system drive.  By default the setting is per user, so it can take quite a lot of space on the system drive, depending upon the java usage and number of users.

On windows XP, Java cache location can be changed though java control panel which can be accessed

    control panel >> Java >> General >> Setting >> Location

But this setting change is missing in Wind0ws 7 through the control panel, in which the above mentioned location is greyed out. To get the desired any of the following method can be used.

Method 1 : Locate javacpl.exe in the java installation directory, and in the

   properties >> compatibility >> Choose run this program in compatibility mode for “Windows XP SP3”

The above change would enable the location change setting in the Java control panel, and then you can change the cache location.

Method 2: Java configuration properties can be changed by making changes in file “deployment.properties” which is normally located at

%SYSTEMDRIVE%\Users\%USERNAME%\AppData\LocalLow\Sun\Java\Deployment

Change(or add if not there) the property  “deployment.user.cachedir” and set it to the desired cache location. Make sure that you escape all the ‘\’ and ‘:’ with ‘\’ in the directory name of the cache location. For Ex if you would like to set the cache to E:\Temp\Java\Cache set the value as

deployment.user.cachedir=E\:\\Temp\\Java\\Cache

Also make sure that java control panel is not open while you are making changes as it would over-write the setting to the one with which its started.

The change needs to be done per user. There are more properties which can be changed by making changes in the “deployment.properties” file, for the list of same please refer to the following url

http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/properties.html

Note : By default the “AppData” folder is hidden and would not be visible when you are opening using explorer. One way is to select  on explorer

 Tool >> View >> Show hidden files…

or else you can open the file directory by using open on your editor and giving following path

%SYSTEMDRIVE%\Users\%USERNAME%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

Thats all.

Advertisements
This entry was posted in Compu and tagged . Bookmark the permalink.

7 Responses to How to change Cache location for Java on windows 7

  1. anon says:

    Excellent !! this worked for me in Windows 7 x64.

  2. Randy says:

    Finally I found something that works! Thanks for posting this.

  3. testing2 says:

    Very helpful… Thanks.

  4. Baruch Atta says:

    We are using an app that uses Java Web Start. Whenever a user has a Java Cache of
    %SYSTEMDRIVE%\Users\%USERNAME%\…
    with the username in the path, the Java Web Start can not start the app.
    When I change the path to c:\Program Files\Java Web Start
    the java web start starts the app normally. Why does it not work in the former case?

  5. cbomb says:

    Cool did the trick

  6. Tony says:

    I dont know why it cant change the cache directory directly, that’s stupid!

    The method 2 worked for me on Windows 7 x64

    Thanks!

  7. Darian says:

    I run 2 SSDs, one for the OS and one as a universal TEMP/ Cache directory (Adobe, Chrome, Windows, etc). This is very helpful for an issue I didn’t know I could change. Thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s