1 / 14

Packaging Java software

Packaging Java software. What the problem is. An executable program often consists of a very large number of files It's a nuisance to manage lots of files We like to "package" files into a single file for transportation and distribution We will explore several different packaging techniques

italia
Télécharger la présentation

Packaging Java software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Packaging Java software

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

  3. Zip files • Zip files are • convenient single archive files • compressed to save space • understood 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 • Create a new archive • Add 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 <applet> tag can request a jar archive

  7. Applets • Here's how an Applet gets loaded: • First, the browser requests the .html page containing the Applet • The <applet code="MyApplet.class" ...> 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 • The applet starts and requests image and sound files • All this two-way communication takes time • Applets load faster if they make fewer requests

  8. Too many files • A complete Java Applet may consist of • many .class files • many .gif and/or .jpg files • possibly some .avi or .mp3 files • other file types may be included • My 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 • You 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 • Most 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 • An applet must be used from an HTML page • The Applet tag has three required parameters: • code = the name of the main class file • height =, width = the size of the applet • To use a jar file, we need a fourth parameter: • archive = name of the jar file • Example: • <applet height="400" width="500" code="TestEngine.class" archive="lispquiz.jar">

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

  14. The End

More Related