Search code examples
javaclassloaderpackagingear

looking for stand-alone class loader


I do have a standalone java program consisting of my own jar and many dependent libraries as single archives (build wby maven, actually 15 JAR files in total). Do some one have already a nice solution she/he can recommend to me how to avoid this and to make packaging smarter?

For example packaging like EAR archives do would be great, but is there any standalone EAR class loader I could use from my NON-Java EE application?


Solution

  • There's the Eclipse Fat Jar plugin. In their own words:

    The Fat Jar Eclipse Plug-In is a Deployment-Tool which deploys an Eclipse java-project into one executable jar.

    It adds the Entry "Build Fat-JAR" to the Export-Wizard. In addition to the eclipse standard jar-exporter referenced classes and jars are included to the "Fat-Jar", so the resulting jar contains all needed classes and can be executed directly with "java -jar", no classpath has to be set, no additional jars have to be deployed.

    Jars, External-Jars, User-Libraries, System-Libraries, Classes-Folders and Project-Exports are considered by the plugin. The Main-Class can be selected and Manifest-files are merged. The One-JAR option integrates a specialised Class-Loader written by Simon Tuffs ( http://one-jar.sourceforge.net/ ) which handles jar-files inside a jar. Individual files and folders can be excluded or added to the jar. Different settings can be stored and re-executed as "Quick Build" via the context-menu.