vhax vhax - 6 months ago 20
Java Question

Where to store libraries required by an applet in order to avoid download them every time applet in oppened

I have developed an applet, it require lots of libraries (around 5mb in .jar files), I know exactly in what pcs it will run, can I put these jars into the system in order to avoid to be downloaded each time the applet is oppened?

The system runs Windows.

The main idea for store these libs in the pc is low bandwidth.

I have tried using proguard in order to compress and reduce code size but it doesn't reduce enough, I need only to download the applet and store all libraries locally.



Tomasz Szuba answer is exactly what I was looking for.

Put all jars into jre/lib/ext/



It would probably be best to just rely on Java applet caching. If you specify your applet object with multiple jars, ones that are not changed won't be redownloaded. For example:

<applet codebase ="." code="com.applet.class"

This way if lib.jar and anotherlib.jar are not changed they won't be redownloaded.

If you really must distributed those libs earlier then:

  1. Omit those lib from archive attribute
  2. Put those libs to extensions library folders. Instructions

Other tutorial provides way to automatically instal extension by applet an using one in it: http://docs.oracle.com/javase/tutorial/ext/basics/download.html