Chapter 55 How to Construct JAR files for Program Distribution.

Slides:



Advertisements
Similar presentations
Applet Security Gunjan Vohra. What is Applet Security? One of the most important features of Java is its security model. It allows untrusted code, such.
Advertisements

Module 4.2 File management 1. Contents Introduction The file manager Files – the basic unit of storage The need to organise Glossary 2.
Creating Jar Files Jin Hung, Gregory Olds, George Blank, Sun Java Web Site.
Objectives:1. Archiving and Packaging Java Code 2. The jar Program 3. Example Applet JAR Files.
Chapter 11 File Systems and Directories. 2 File Systems File: A named collection of related data. File system: The logical view that an operating system.
JAR and Packages Section 4.5 (JIA’s) Section 3.3 (ALBING’s) Section 5.11 (ALBING’s)
File Management Systems
11/7/06 1 Hofstra University - CSC005 Chapter 11 File Systems and Directories.
Slides prepared by Rose Williams, Binghamton University Chapter 5 Defining Classes II.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L06 (Chapter 16) Applets.
1 Chapter 3 Programs and Packages. 2 Java Virtual Machine (JVM) Java programs execute on the JVM. The JVM is a virtual rather than a physical machine,
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 4: Implementing and Managing Group and Computer Accounts.
Java Jar Files Bar-Ilan University תשס"ה by Moshe Fresko.
Current Topics in Programming Languages Lecture 15_1 George Koutsogiannakis SUMMER
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 4: Implementing and Managing Group and Computer Accounts.
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 11 Managing and Monitoring a Windows Server 2008 Network.
Deployment. Packaging programs in Jar files Deployment applications with Java web start Creating and deploying applets with Java Plug-in.
Deploying Java applications as JAR files SE-2030 Dr. Mark L. Hornick 1 How to package an application so that you can run it outside of Eclipse.
עיצוב תוכנה מונחה עצמים תירגול 1. 1.Packages and Paths 2.Jar Files Outline.
Android 4: Creating Contents Kirk Scott 1. Outline 4.1 Planning Contents 4.2 GIMP and Free Sound Recorder 4.3 Using FlashCardMaker to Create an XML File.
1 CSE 331 Java Packages; JAR Archives slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
9.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
PACKAGES Mimi OpkinsCECS277. What We’ll Cover  Packages and Import Statements  The Package java.lang  Package Names and Directories  The Default Package.
Access Control Problem A primary consideration in object- oriented design is to “separate the things that change from the things that stay.
Chapter 11 File Systems and Directories Chapter Goals Describe the purpose of files, file systems, and directories Distinguish between text and.
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring, Managing, and Troubleshooting Resource Access.
Java™ How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 12: Finale! Publishing Your Android App. Objectives In this chapter, you learn to: Understand Google Play Target various device configurations.
Implementation Yaodong Bi. Introduction to Implementation Purposes of Implementation – Plan the system integrations required in each iteration – Distribute.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring, Managing, and Troubleshooting Resource Access.
2. Database System Concepts and Architecture
Deploying Java applications as JAR files SE-2030 Dr. Rob Hasker 1 Based on material by Dr. Mark L. Hornick.
FILES & FOLDERS Organization Computer hard drives hold an enormous amount of data or information. Knowing how a computer's organization system works.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
Managing Software Patches 10/15/ Introducing Solaris OE Patches A patch contains collection of files and directories Patch replaces existing files.
Chapter 11 File Systems and Directories. 2 File Systems File: A named collection of related data. File system: The logical view that an operating system.
Deployment via jars and Webstart. How do we distribute our application? Lab says you need to submit CD Lab says you need to submit CD Limitations of CD.
AIP Backup & Restore Sunita Barve NCRA, Pune. AIP The latest version of DSpace 1.7.0, supports backup and restore of all its contents as a set of AIP.
11 DISASTER RECOVERY Chapter 13. Chapter 13: DISASTER RECOVERY2 OVERVIEW  Back up server data using the Backup utility and the Ntbackup command  Restore.
Chapter 10 Chapter 10: Managing the Distributed File System, Disk Quotas, and Software Installation.
DOS and the Command Line CS 21a: Introduction to Computing I First Semester,
Chapter 3 Understanding Ant datatypes and properties.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
The world leader in serving science Overview of Thermo 21 CFR Part 11 tools Overview of software used by multiple business units within the Spectroscopy.
Java Software Solutions Lewis and Loftus Chapter 9 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Enhanced Class Design -- Introduction.
Building Packages BCIS 3680 Enterprise Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 5 Methods.
Build Systems Presentation December 14, 2015 Noon-1pm Kathy Lee Simunich Bldg. 203/ D120 Brought to you by: Argonne Java.
Jar Files The Basics. 2 Outline Create a Jar Viewing the Contents of a JAR File Extracting the Contents of a JAR File Modifying a Manifest File Running.
Packages. Access Specifications Public Available anywhere (public keyword) Only one public class per file allowed Protected Available in subclasses, and.
Java Package Advantage of Java Package
© 2004 Pearson Addison-Wesley. All rights reserved September 5, 2007 Packages & Random and Math Classes ComS 207: Programming I (in Java) Iowa State University,
Installing and Using Evolve Evolve is written in Java and runs on any system with Java 1.6 Download Evolve from Unzip.
Chapter 5: MACHINATIONS
CS1010 Programming Methodology
CS1010 Programming Methodology
JAR Files Objectives: 1. Archiving and Packaging Java Code
Java Packages B.Ramamurthy 11/11/2018 B.Ramamurthy.
TOSCA-Metadata (directory )
Understanding and Creating Jar files in Java
IS3440 Linux Security Unit 4 Securing the Linux Filesystem
Packages and Interfaces
TOSCA-Metadata (directory )
Executable Jars Dan Fleck Fall /27/2018.
Classes 5/5 May 14, 2019 ICS102: Classes 5/5.
Presentation transcript:

Chapter 55 How to Construct JAR files for Program Distribution

The Java JAR file has an unfortunate name, inasmuch as archiving is but one of several reasons why you should gather together all your application files into a JAR file. Other reasons include the following: –JAR files simplify program distribution. You have only one file to move about, rather than a whole directory, or directory hierarchy, full of files. –JAR files save space and time. You have only one compressed JAR file to store or to ship over the web. –JAR files provide version management. Each time you reach a stable point in your program, you can create a JAR file. –JAR files enable security. You can add a digital signature to a JAR file that lessens the chance that a manipulated version will get into the hands of an innocent user.

Before you create a JAR file, you need to create an application-describing manifest file. Minimally, your manifest file needs just one line that identifies the application class that starts your application. For example, if the MovieApplicationTestor class starts your application, then the manifest file must contain the following line: Main-Class: MovieApplicationTestor

Once you have a manifest file, say manifest.txt, then you can create a JAR file using the command-line jar program. Suppose, for example, that your current directory contains all the class files needed by your movie application program. Then, you can create a JAR file by typing the following: *-- Command | *-- Manifest file | | *-- JAR file produced | | | *-- Included class files | | | | v v v v jar -cmf manifest.txt MovieApplication.jar *.class --- ^ *-- c means create a new JAR file m means use the following manifest file f means use the file name supplied You can use wildcards to identify a collection of files, as shown. Alternatively, you can supply a list of explicit file names, separated by spaces.

If you have divided your application into packages—such as the application, model, and view packages—then your directory structure will include a directory with application, model, and view subdirectories. To combine all the class files in those subdirectories into a JAR file, you type the following, once you have made the current directory be the parent directory of the application, model, and view directories. jar -cmf manifest.txt MovieApplication.jar application model view If you want only the class files in those directories, you use a wildcard—by typing, for example, application/*.class, instead of application.

If your application includes all the images in an image directory, you can include those images in the JAR file as follows: jar -cmf manifest.txt MovieApplication.jar application model view images Alternatively, if your applications includes all the images in the current directory, in files with a jpg extension, you type the following: jar -cmf manifest.txt MovieApplication.jar application model view *.jpg

Once you have a JAR file, running a standalone application is straightforward. You are accustomed to typing the following to start an application from a class file: java MovieApplicationTestor To start an application from a JAR file, you type the following: java -jar MovieApplication.jar Note that, for the JAR version to work, you must have created the JAR file using a manifest file, that identifies the MovieApplicationTestor class as the application-starting class.

Certain applications use previously prepared JAR files. If your application uses such a previously prepared JAR file—say, the Entertainment.jar file—you would include a reference to it file in your JAR file's manifest, as shown in the following expansion of the manifest file introduced previously. Main-Class: MovieApplicationTestor Class-Path: Entertainment.jar

If you like, you can include useful descriptive information in the manifest file. For example, you can describe each package by a section that begins with its relative path name, including the trailing slash. Then, you can specify, for example, version details: Main-Class: MovieApplicationTestor Class-Path: Entertainment.jar Name: application/ Specification-Title: "Application specifications" Specification-Version: "3.141" Specification-Vendor: "XYZ, Inc." Implementation-Title: "Application implementation" Implementation-Version: "Build 2.718" Implementation-Vendor: "XYZ, Inc." Name: model... Name: view...