Last Updated: October 20, 2022
Steps:
- 1.Go to the pom file. as shown in Figure 1.
-

Figure 1. prjoect
- 2.Add the plugin to the pom file. as shown in Figure 2.
-
Unresolved include directive in modules/6.x.x/pages/frameworks/tutorials/create-runnable-jar-tutorial.adoc - include::inc/runnable-jar1.xml[]

Figure 2. pom file
change <mainClass>com.path.to.YourMainClass</mainClass> with path to your Main Class. |
- 3.Update maven project. as shown in Figure 3.
-
Right-click on the project → Maven → Update Project Or Alt + F5, then Click OK.

Figure 3. update maven project
- 4.Run the project as maven build. as shown in Figure 4.
-
Right-click on the Run As → Maven build ,Click on the package, then OK.

Figure 4. create runnable jar file
Wait for the build to finish. as shown in Figure 5.

Figure 5. create runnable jar file
- 5.Navigate to target file in your project location. as shown in Figure 6.
-

Figure 6. navigate to project
You should see a jar file created as shown in Figure 6.
- 6.Run with command line. as shown in Figure 7.
-
open CMD or Terminal and type :
cd [Path] java -jar [YourJarName].jar
Replace [Path] with your project path and [YourJarName.jar] with your jar file name. |

Figure 7. run with command
You have created a runnable jar file.