You can transform a Java project into a JAR file. This JAR file is a Java Archive of several Java files.
It can be executed like a program.
Let's see a way to create a JAR file, with 2 IDE such as NetBeans and Eclipse, and we will execute it with a command line tool.
It will remove all old compiled files and recompile the project to build a JAR file.
A JAR file is like a ZIP archive that contains all compiled files.
OK, now go until your project directory to find a dist or a jar folder (the name you specified up above).
Inside we can see the HelloWorld.jar.
Open a shell and write it:
Result:
You can also open this JAR file with a software of extraction such as Winrar.
Inside you will see a directory named META-INF and the HelloWorld.class file.
In the META-INF directory there is a new file named MANIFEST.MF.
This file specifies the name of the Manifest-Version, the Class-Path and the Main-Class.
Add new comment