What is a JAR file?
Options
- A ZIP-based file that bundles classes and resources (Correct option)
- A code editor that is installed together with the JDK
- A type of exception thrown when a class is missing
- A Maven command that cleans the whole project folder
Answer
A Java ARchive: a ZIP-based file that bundles compiled classes and resources so a library or application can be shipped as one file
Why
After compiling, you have many .class files. A JAR packs them into one file.
Libraries are distributed as JARs (for example Jackson or JUnit). A Spring Boot application is usually built as an executable JAR that you start with java -jar app.jar.
With Maven, mvn package puts the JAR in the target folder.
Remember
JAR = a zip of compiled Java code.