Lesson1 : Using JAR Files: The Basics

JAR files are packaged with the ZIP file format, so you can use them for “ZIP-like” tasks such as lossless data compression, archiving, decompression, and archive unpacking. These are among the most common uses of JAR files, and you can realize many JAR file benefits using only these basic features.

Even if you want to take advantage of advanced functionality provided by the JAR file format such as electronic signing, you’ll first need to become familiar with the fundamental operations.

To perform basic tasks with JAR files, you use the JavaTM Archive Tool provided as part of the Java Development Kit. Because the Java Archive tool is invoked by using the jar command, for convenience we’ll call it the “Jar tool”.

As a synopsis and preview of some of the topics to be covered in this lesson, the following table summarizes common JAR-file operations:

Operation    Command

To create a JAR file    jar cf jar-file input-file(s)

To view the contents of a JAR file    jar tf jar-file

To extract the contents of a JAR file    jar xf jar-file

To extract specific files from a JAR file    jar xf jar-file archived-file(s)

To run an application packaged as a JAR file (requires the Main-class manifest header)   

java -jar app.jar

To invoke an applet packaged as a JAR file   

        archive=”JarFileName.jar”

        width=width height=height>

Related Posts

Prerequisites for a Java Web Application

simple

January 19, 2016

Java

Prerequisites for a Java Web Application If there is no JDK installed on your System you must first download it for the appropriate platform. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html You also need a current installation of Netbeans which you can download from: https://netbeans.org/downloads/ Last but not least we also need an application server and choose therefor Tomcat, which you […]

Read More

Setup Primefaces Website with Google Maps (Tutorial and Example)

simple

January 17, 2016

Java

To setup a JSF Website using Primefaces with Google Maps not much time is necessary. As en environment this tutorial requires you to use a current Java Development Kit JDK, the Netbeans IDE and a working Tomcat Installation. Prerequisite If there is no JDK installed on your System you must first download it for the […]

Read More

Leave a Reply