Java system cache location

Where is the jar files cached for Java Web Start/JNLP applications?

At least in Windows, it will not store the jar with the original name (not even with .jar file extension). Check the time stamp and file size to get your requested jar files.

6 Answers 6

It depends. on your OS and virtual machine, e.g.:

  • with a Sun JDK 1.5 and Windows XP: C:\Documents and Settings\userid\Application Data\Sun\Java\Deployment\cache\javaws\
  • with a Sun JDK 1.6 and Vista: C:\Users\userid\AppData\LocalLow\Sun\Java\Deployment\cache\6.0
  • with a Sun JDK 1.6 and GNU/Linux: /home/userid/.java/deployment/cache/6.0
  • with a Sun JDK 1.6 and Mac OS X: ~/Library/Caches/Java/cache/6.0/

With a Sun JDK 6, this can be configured through the Java Control Panel (Temporary Internet Files Settings in the General tab).

On Windows Vista or 7, it’s in %AppData%\LocalLow\Sun\Java\Deployment\cache .

It is worth mentioning that the file extension is not jar. So, you may check the file size and find it somehow.

Don’t works but %HOMEPATH%\appdata\LocalLow\Sun\Java\Deployment\cache is ok. %AppData% go to %HOMEPATH%\appdata\Roaming

There is more to JNLP than just Sun’s implementation.

The OpenJDK packages shipped by Debain, for instance, bundle netx, which stores its files in ~/.netx/cache/ . The Wikipedia entry has a list of known implementations other than Sun’s.

You really shouldn’t rely on this path being well-known in your application’s code.

If you happen to be using netx.jar from icedteaweb you can specify ` -Xclearcache` command line param

For ubuntu and other debian based linux distros using icedtea: /home/$/.icedtea/cache

In case you want just to clear the cache javaws -uninstall won’t work. javaws -Xclearcache does the job for icedtea.

If you are also interested in the content of the jars in the JNLP cache you might want to use the following script (tested on Mac OS X) to examine the jar files with jar -tvf:

#!/bin/bash # Author: WF # see http://stackoverflow.com/questions/1517350/where-is-the-jar-files-cached-for-java-web-start-jnlp-applications os=`uname` case $os in # Mac OS X Darwin*) jnlpcache="$HOME/Library/Application Support/Oracle/Java/Deployment/cache/6.0" ;; *) echo "to make this script work for $os you might want to edit it" 1>&2 echo "and add a case option" 1>&2 echo "please copy your result back to the stackoverflow answer" 1>&2 exit 1 ;; esac cd "$jnlpcache" tmp="/tmp/jnlp$$" for f in `find . -type f` do jar -tvf $f 2>/dev/null > $tmp if [ $? -eq 0 ] then echo "found jar $f" echo "it contains: " cat $tmp fi done rm $tmp 

Источник

Java system cache location

ApacheCon

Java Caching System

JCS is a distributed caching system written in Java. It is intended to speed up applications by providing a means to manage cached data of various dynamic natures. Like any caching system, JCS is most useful for high read, low put applications. Latency times drop sharply and bottlenecks move away from the database in an effectively cached system. Learn how to start using JCS.

The JCS goes beyond simply caching objects in memory. It provides numerous additional features:

  • Memory management
  • Disk overflow (and defragmentation)
  • Thread pool controls
  • Element grouping
  • Minimal dependencies
  • Quick nested categorical removal
  • Data expiration (idle time and max life)
  • Extensible framework
  • Fully configurable runtime parameters
  • Region data separation and configuration
  • Fine grained element configuration options
  • Remote synchronization
  • Remote store recovery
  • Non-blocking «zombie» (balking facade) pattern
  • Lateral distribution of elements via HTTP, TCP, or UDP
  • UDP Discovery of other caches
  • Element event handling
  • Remote server chaining (or clustering) and failover
  • Custom event logging hooks
  • Custom event queue injection
  • Custom object serializer injection
  • Key pattern matching retrieval
  • Network efficient multi-key retrieval

JCS 3.x works on JDK versions 1.8 and up. It has no mandatory external dependencies. See the document about upgrading.

JCS 2.x works on JDK versions 1.6 and up. It only has a dependency on Commons Logging. See the document about upgrading.

JCS is a Composite Cache

The foundation of JCS is the Composite Cache, which is the pluggable controller for a cache region. Four types of caches can be plugged into the Composite Cache for any given region: (1) Memory, (2) Disk, (3) Lateral, and (4) Remote. The Composite Cache orchestrates access to the various caches configured for use in a region.

The JCS jar provides production ready implementations of each of the four types of caches. In addition to the core four, JCS also provides additional plugins of each type.

LRU Memory Cache

The LRU Memory Cache is an extremely fast, highly configurable memory cache . It uses a Least Recently Used algorithm to manage the number of items that can be stored in memory. The LRU Memory Cache uses its own LRU Map implementation that is significantly faster than both the commons LRUMap implementation and the LinkedHashMap that is provided with JDK1.4 up. This makes JCS faster than its competitors .

Indexed Disk Cache

The Indexed Disk Cache is a fast, reliable, and highly configurable swap for cached data. The indexed disk cache follows the fastest pattern for disk swapping. Cache elements are written to disk via a continuous queue-based process. The length of the item is stored in the first few bytes of the entry. The offset is stored in memory and can be reference via the key. When items are removed from the disk cache, the location and size are recorded and reused when possible. Every aspect of the disk cache is configurable, and a thread pool can be used to reduce the number of queue worker threads across the system.

JDBC Disk Cache

The JDBC Disk Cache is a fast, reliable, and highly configurable disk cache. It stores both the keys and elements in a JDBC compatible database. The JDBC disk cache stores elements in a database as BLOBs. Periodically, the table is swept to remove expired elements. Multiple instances can be configured to use a common connection pool. A thread pool can be used to reduce the number of queue worker threads across the system. The MySQL version of the JDBC Disk Cache can optimize and repair tables.

TCP Lateral Cache

The TCP Lateral Cache provides an easy way to distribute cached data to multiple servers. It comes with a UDP discovery mechanism, so you can add nodes without having to reconfigure the entire farm. The TCP Lateral Cache works by establishing connections with socket server running on other nodes. Each node maintains a connection to every other. Only one server is needed for any number of regions. The client is able to re-establish connections if it looses its connection with another server. The TCP Lateral is highly configurable . You can choose to only send data, to not look for data on other servers, to send removes instead of puts, and to filter removes based on hash codes.

RMI Remote Cache

JCS also provides an RMI based Remote Cache Server . Rather than having each node connect to every other node, you can use the remote cache server as the connection point. Each node connects to the remove server, which then broadcasts events to the other nodes. To maintain consistency across a cluster without incurring the overhead of serialization, you can decide to send invalidation messages to the other locals rather than send the object over the wire. The remote cache server holds a serialized version of your objects, so it does not need to be deployed with your class libraries. The remote servers can be chained and a list of failover servers can be configured on the client.

What JCS is not

JCS is not a tag library or a web specific application. JCS is a general purpose caching system that can be used in web applications, services, and stand alone Java applications.

JCS is not a transactional distribution mechanism. Transactional distributed caches are not scalable. JCS is a cache not a database. The distribution mechanisms provided by JCS can scale into the tens of servers. In a well-designed service oriented architecture, JCS can be used in a high demand service with numerous nodes. This would not be possible if the distribution mechanism were transactional.

JCS does not use AOP. JCS is a high performance, non-invasive cache. It does not manipulate your objects so it can just send a field or two fewer over the wire.

JCS is not a fork, an offshoot, a branch, or any other derivation of JCS. Nor is JCS named after another library. JCS is a mature project that has been under development and in use since 2001. Over the years JCS has incorporated numerous bug fixes and has added dozens of features, making it the best designed and most feature rich caching solution available.

Copyright © 2002-2022 The Apache Software Foundation. All Rights Reserved.

Apache Commons, Apache Commons JCS, Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

Источник

Java system cache location

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

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

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

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

Источник

Читайте также:  Css media query sass
Оцените статью