-1

I have a jar file that references 6 other jars through a manifest file.

I now, however, want to try and compile the jars into one jar file, reasons being: I want them to be cached so the applet does not have a long loading time as one of those jars are required, rather one big waiting time to download all required files and then store it in the cache.

I have tried including the referenced Jar files in the build, unfortunately, all this does is cause a java.lang.NoClassDefFoundError error, so I had to add a manifest file.

What is the best/easiest way to achieve this? I am using eclipse, and not building with ant.

Corne
  • 496
  • 2
  • 8
  • 22
  • *"I want them to be cached so the applet does not have a long loading time as one of those jars are required"* That makes little or no sense. E.G. The 'fat jar' will take 4 times as long to download as the 4 separate Jars. You would be better off deploying the applet using JWS/JNLP & specifying the other Jars as `lazy` downloads. – Andrew Thompson Apr 18 '13 at 09:52
  • The reason behind this is that the application would be used daily by clients, I want the data to be cached rather than having to download the 2MB every time the application is opened.. – Corne Apr 18 '13 at 11:02
  • Caching the classes is the **default behavior** of both standard deployed applets *and* JNLP. This is a non-question. – Andrew Thompson Apr 18 '13 at 11:04

1 Answers1

0

Using eclipse while exporting you can create with the option of Package required libraries into generate JAR

By doing this eclipse uses its own class loader and reference all the files which are packed in a single jar.

Rohit
  • 743
  • 4
  • 10
  • Infact, it is packeged within the Jar.. But still you must reference it with the Manifest. As soon as the manifest reference is gone I receive the java.lang.NoClassFoundError.. – Corne Apr 18 '13 at 09:31
  • 1
    Note that only a trusted applet can use a custom class-loader. – Andrew Thompson Apr 18 '13 at 09:52