Presentation is loading. Please wait.

Presentation is loading. Please wait.

Packaging Java software. What the problem is zAn executable program often consists of a very large number of files zIt's a nuisance to manage lots of.

Similar presentations


Presentation on theme: "Packaging Java software. What the problem is zAn executable program often consists of a very large number of files zIt's a nuisance to manage lots of."— Presentation transcript:

1 Packaging Java software

2 What the problem is zAn executable program often consists of a very large number of files zIt's a nuisance to manage lots of files zWe like to "package" files into a single file for transportation and distribution zWe will explore several different packaging techniques zDifferent techniques are suitable for different situations and kinds of programs

3 Zip files zZip files are yconvenient single archive files ycompressed to save space yunderstood on all platforms  Most Windows users have probably used WinZip to unpack downloaded files  Fewer people have used WinZip to create zip files

4 Creating a.zip file, I  To create a.zip file, use WinZip Classic

5 Creating a.zip file, II  The WinZip Classic interface is easy to figure out yCreate a new archive yAdd files to it

6 jar files  A jar (Java archive) file is like a zip file  jar files were designed for Java, but can be used for any kind of files  The jar program is modeled after the UNIX tar program and works very much like it  tar originally stood for tape archive  jar files are particularly important for Applets  An tag can request a jar archive

7 Applets zHere's how an Applet gets loaded:  First, the browser requests the.html page containing the Applet  The tag causes the browser to request the file MyApplet.class  The browser's Java VM looks at this file and makes requests for other.class files that may be needed yThe applet starts and requests image and sound files zAll this two-way communication takes time zApplets load faster if they make fewer requests

8 Too many files zA complete Java Applet may consist of  many.class files  many.gif and/or.jpg files  possibly some.avi or.mp3 files yother file types may be included zMy most complex "animation" applet uses:  One.html file  Four.class files  Fifty.jpg files

9 Creating a jar file  Example command: jar cvf arch.jar *.class  cvf is a list of options  c -- create a jar file  v -- verbose; tell what you do as you do it  f -- use this jar file (almost always needed!)  arch.jar is the name of the file that is created  You don't need the.jar extension, but it's a good idea  *.class says to include all class files xYou can list additional files at the end

10 Unpacking a jar file  Example command: jar xvf arch.jar  cvf is a list of options  x -- extract from a jar file  v -- verbose; tell what you do as you do it  f -- use this jar file (almost always needed!)  arch.jar is the name of the file that is unpacked  You will also get a "manifest" file that may contain information about the jar file xMost of the time you can ignore the manifest file

11 Examining a jar file  Example command: jar tvf arch.jar  cvf is a list of options  t -- tell what is in the jar file  v -- verbose; tell what you do as you do it  f -- use this jar file (almost always needed!)  arch.jar is the name of the file that is examined

12 Using a jar file in an Applet zAn applet must be used from an HTML page zThe Applet tag has three required parameters:  code = the name of the main class file  height =, width = the size of the applet zTo use a jar file, we need a fourth parameter:  archive = name of the jar file zExample: y

13 Other options  InstallAnywhere is also widely used  InstallAnywhere Now! is the basic version  Now! is free  InstallShield Pro is widely used z "Industrial strength" z $995

14 The End


Download ppt "Packaging Java software. What the problem is zAn executable program often consists of a very large number of files zIt's a nuisance to manage lots of."

Similar presentations


Ads by Google