In a project I am taking over, I found a Jar file with the following MANIFEST.MF file:
Manifest-Version: 1.0
Start-Class: com.xxx.Application
Spring-Boot-Version: 1.2.7.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher
What is the difference between Start-Class and Main-Class?
The main class can be defined as a start-class element in the pom.xml's properties section: <properties> <!-- The main class to start by executing "java -jar" --> <start-class>com.baeldung.DemoApplication</start-class> </properties>
The manifest file is named MANIFEST. MF and is located under the META-INF directory in the JAR. It's simply a list of key and value pairs, called headers or attributes, grouped into sections.
mf extension is a Java Manifest file that contains information about the individual JAR file entries. The MF file itself is contained inside the JAR file and provides all the extension and package-related definition. JAR files can be produced to be used as an executable file.
This is a feature of Spring Boot.
Main-Class defines that Spring Boot's org.springframework.boot.loader.JarLauncher
class will be launched in a first step.
In a second step, org.springframework.boot.loader.JarLauncher
will launch the main
method of the class that is given to the Start-Class property - in this case, com.xxx.Application
.
For details, see https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With