Java Archive (JAR): Building Java Archives

Java    |    Beginner
  • 12 videos | 1h 39m 12s
  • Includes Assessment
  • Earns a Badge
Rating 4.4 of 31 users Rating 4.4 of 31 users (31)
Java Archives (JARs) wrap a Java application into a single archive file for deployment, distribution, and execution. Use this course to acquaint yourself with building Java archives or JAR files using the JAR utility, run from the command line. Over the length of the course, you'll outline how a simple Java project packaged into a JAR file can be executed directly, different attributes of a JAR manifest can affect the use of a JAR file, and a project with external dependencies can be packaged into an executable JAR. Upon completion of this course, you'll be able to build different Java archives: JAR with multiple main classes, JAR containing several packages, and JAR that is not directly executable by itself but usable as a dependency in other projects.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Use an integrated development environment (ide) to create the main class for a java project
    Create and execute a basic java archive using a manifest file
    Extract and recognize the contents of a java archive (jar)
    Outline the automatic generation of manifests and the fields contained in them
    Edit and specify the data stored inside the manifest file of a jar
  • Build a java application with a dependency on an external library
    Reference and use external dependencies in your jar
    Construct a jar file with multiple main classes and run each of them
    Create jar files with multiple packages to store related code
    Use non-executable jar files as libraries in other projects
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 25s
    In this video, you’ll learn more about your instructor and this course. In this course, you’ll learn how to build Java archive or JAR files using the JAR utility. You’ll start by creating a simple Java project with a main class and then package it into a jar file which can be executed directly. You’ll look at the jar manifest file and learn the different attributes this includes. You’ll build a project with external dependencies. FREE ACCESS
  • 12m 41s
    In this video, you’ll learn more about building Java archives. Java archives are a package that includes Java class files as well as associated resources such as text, images, and more. These are meant for distribution to users of your applications. Packaging everything into a single file makes it easy enough for your users to add to their own class paths and then reference your classes in their applications. FREE ACCESS
  • Locked
    3.  Building and Running an Executable JAR
    11m 13s
    In this video, you’ll watch a demo. You’ll confirm what the output should look like when you execute the JAR file by first running your program from your IDE. You’ll navigate to the source file itself and then simply right click and choose the option to Run. This will automatically create a Run configuration that points to this particular file. You’ll then execute it. You’ll be able to see the execution was a success. FREE ACCESS
  • Locked
    4.  Viewing the Contents of a JAR File
    7m 47s
    In this video, you’ll watch a demo. You’ll see how a package is created, including the file structure and any files that have been created automatically. To view the contents, you can use the JAR binary or the tar utility. You’ll run the command tar tvf followed by the name of the JAR, my-first-jar.jar. Or, you could use the command jar with the options tvf followed by the name of the JAR file. FREE ACCESS
  • Locked
    5.  Creating a JAR without an Input Manifest
    8m 7s
    In this video, you’ll watch a demo. In this demo, you’ll learn to create a JAR file without an input manifest. First, you’ll need to create a JAR. This JAR will contain the EntryPoint class that was generated from building your project. First, you’ll navigate over to the directory where the build output will be accessible. From there, you’ll make use of the jar command. FREE ACCESS
  • Locked
    6.  Defining a Detailed Manifest File
    7m 27s
    In this video, you’ll watch a demo. In this demo, you’ll define a detailed manifest. You’ll see end users may have a set of specifications they expect your application to adhere to, around which they will have configured their environment. This makes it important to use the jars manifest file, which was used to build your app. You’ll also learn about other pieces of information that can be included in a JAR manifest. FREE ACCESS
  • Locked
    7.  Adding Dependencies to a Project
    10m 24s
    In this video, you’ll watch a demo. In this demo, you’ll explore how it’s possible to create a project which includes external dependencies. You’ll also see what it means to archive a project in a JAR file, to reference those dependencies. The dependency you’ll learn here is the logging library of Apache's Log4j 2. You’ll navigate over to the URL, logging.apache.org/log4j/2.x/download.html. You’ll then download the Log4j 2 library. FREE ACCESS
  • Locked
    8.  Building a JAR File with Dependencies
    10m 55s
    In this video, you’ll watch a demo. In this demo, you’ll learn how to build a JAR file with dependencies. You’ll see when it comes to the JAR file, you must make sure it references the dependent libraries of your application. To do so, you’ll need to specify the dependencies inside the manifest input file. First, you’ll navigate over to manifest.txt, and you’ll add in a new key and value pair. FREE ACCESS
  • Locked
    9.  Constructing JAR Files with Multiple Main Classes
    9m 51s
    In this video, you’ll watch a demo. In this demo, you’ll learn to construct JAR files with multiple main classes. You’ll learn how to include another class inside your project, one that also includes a main method. You’ll see how it can be packaged as a JAR file and then executed. For that, you’ll create an additional source file inside the com.loonycorn package. This will be a Java Class, called Person. FREE ACCESS
  • Locked
    10.  Creating JARs with Multiple Packages
    7m 25s
    In this video, you’ll watch a demo. In this demo, you’ll create JARs with multiple packages. First, to create a new package, you’ll right click in the source folder and then choose the option to create a New Package. You’ll name this new package com.loonycustomer. Inside the loonycustomer package, you’ll add a customer as a different type of Person. Once the package is ready, you’ll add a new Java Class inside it. FREE ACCESS
  • Locked
    11.  Using JAR Files as an External Library
    8m 19s
    In this video, you’ll watch a demo. In this demo, you’ll learn to use JAR files as external libraries. It is common to use a JAR file as an external library or a dependency in another project. You’ll first create a new project workspace directory. You’ll create a New Folder and call it AnotherJavaProject. You’ll create an IntelliJ project out of it, so you’ll need to navigate to that IDE. FREE ACCESS
  • Locked
    12.  Course Summary
    2m 37s
    In this video, you’ll summarize what you’ve learned in this course. You created a simple Java project. You then learned how to create a basic Java archive or JAR, a package that stores compiled classes of an application and can include associated resources. You explored the contents of JAR files, including the manifest file, which includes useful information about the archive. You also executed a JAR file and confirmed it produces the expected output.  FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.6 of 62 users Rating 4.6 of 62 users (62)
Rating 4.7 of 84 users Rating 4.7 of 84 users (84)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 70 users Rating 4.5 of 70 users (70)
Rating 4.5 of 1884 users Rating 4.5 of 1884 users (1884)
Rating 4.3 of 47 users Rating 4.3 of 47 users (47)