tl  tr
 Video Tutorials > Java > Basics > How to create Java Executable JAR with JAR dependencies

How to create Java Executable JAR with JAR dependencies 

The following video shows creating an executable JAR file with other JAR dependencies.

  1. Create a simple standalone java application, for instance a simple Swing UI application with two dependent libraries (commons-lang3-3.0.1.jar and commons-io-2.1.jar).
  2. Compile and run the application for sanity.
  3. Create a manifest file with Main-Class and Class-Path attributes. The library path is relative to the JAR root directory.
  4. Ensure to enter a new line at the end of manifest file. Otherwise some systems may throw failed to load Main-Class error.
  5. Execute JAR command from the console (Ensure to include JDK_HOME\bin in Path environment variable).
  6. Run the executable JAR from the console and "Open with" windows dialog.

Download Source code for this article (2 KB)



Books Recommendation

bl  br