Java applications are typically delivered as JAR (short for Java Archive) files.
Not all JAR files are executable. Some may be just a library that you you reuse in your own application.
While some executable JAR files can be launched simply by double-clicking, the fool-proof way to run a jar file is to
java -jar command e.g.,
java -jar foo.jar launches the
A normal JAR file contains only the classes and resources that you created for your app. If you app has dependencies (i.e., third party libraries that your app depends on), the JAR file will not work unless the person running the JAR file also has those dependencies in their computer. This is not ideal.
A fat JAR (aka uber JAR) file solves the above problem by including all the dependencies inside the JAR file itself (which makes the JAR file bigger than usual, hence the term fat).
Creating a JAR file in Intellij - A video by Artur Spirin:
Although JUnit is a third-party library, you need not package it into a fat JAR file because JUnit is used only in the test code, not in the application code.
But if you use JavaFX, you need to create package it into a fat JAR.
If you are using Gradle in your project, you can use it to create a JAR file as given in the panel below.
(Although JUnit as test classes are not packaged into the JAR file).