Repaso
EspaƱol
Java CoreFoundationsJV-51

What is a JAR file?

Options

  1. A ZIP-based file that bundles classes and resources (Correct option)
  2. A code editor that is installed together with the JDK
  3. A type of exception thrown when a class is missing
  4. 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.

Key terms

Practice this question in Repaso