Skip to main content  
        iSeries home   |   Easy400     |   CGIDEV2     |   MMAIL  
Public-Source
 
Introduction
Command set 1
Command set 2
Appendix A
 Appendix B
 Download
 
 

 
Appendix B
Work with Qshell "jar" command

Though you do not need to know nor to practice it, you may still be interested about how Qshell command "jar" (Java Archive) works in its native mode.
Have a look at the ORACLE page for it.

  1. Command STRQSH (start QSH) has a CMD parameter. It allows to run a Qshell command.
    If you enter command STRQSH from the Command Entry screen without spacifying anything for the CMD parameter, you get to the Qshell Command Entry screen.
  2. Enter command jar without anything else. You will receive the help of this command, showing all its options:
                                    QSH Command Entry 
    
       $
     > jar
       Options:
           -c  create new archive
           -t  list table of contents for archive
           -x  extract named (or all) files from archive
           -u  update existing archive
           -v  generate verbose output on standard output
           -f  specify archive file name
           -m  include manifest information from specified manifest file
           -e  specify application entry point for stand-alone application
               bundled into an executable jar file
           -0  store only; use no ZIP compression
           -P  preserve leading '/' (absolute path)
               and ".." (parent directory) components from file names
           -M  do not create a manifest file for the entries
           -i  generate index information for the specified jar files
           -C  change to the specified directory and include the following file
       If any file is a directory then it is processed recursively.
       The manifest file name, the archive file name and the entry point name are
       specified in the same order as the 'm', 'f' and 'e' flags.
    
       Example 1: to archive two class files into an archive called classes.jar:  
              jar cvf classes.jar Foo.class Bar.class
       Example 2: use an existing manifest file 'mymanifest' and archive all the  
                  files in the foo/ directory into 'classes.jar':
              jar cvfm classes.jar mymanifest -C foo/ .
    
       $
     
     ===>                                                                              
                                                                                       
                                                                                       
    
     F3=Exit   F6=Print F9=Retrieve F12=Disconnect                                     
     F13=Clear F17=Top  F18=Bottom  F21=CL command entry

You may then try the following sample commands. Upon installation of this utility you may play with stream files a.txt and b.txt in IFS directory /zip/test.

Examples:

  1. jar -cvfM  /tmp/x.zip /zip/test/a.txt /zip/test/b.txt
    This command compresses into file /tmp/x.zip the following objects:
    • zip/test/a.txt
    • zip/css/
    • zip/css/css.css
    • zip/css/cssprint.css
    The compressed files maintain partially their directory paths.
    How to decompress this zipped file:
    1. Windows unzips the objects - with their directories- in a subdirectory of the directory hosting the zipped file.
    2. On IBMi
      • command jar -xvfM /tmp/x.zip and
      • command jar -xvf  /tmp/x.zip
      re-create the objects with their directories in the current directory ( usually directory /home/user_name ).
  2. jar -cvfMP /tmp/x.zip /zip/test/a.txt /zip/test/b.txt
    This command compresses into file /tmp/x.zip the following objects:
    • /zip/test/a.txt
    • /zip/css/
    • /zip/css/css.css
    • /zip/css/cssprint.css
    The compressed files maintain completely their directory paths.
    How to decompress this zipped file:
    1. Windows detects the compressed (zipped) file as invalid, whatever directory you load it.
    2. On IBMi
      • command jar -xvfMP /tmp/x.zip
        re-creates the objects with their directories in the root directory.
        In other words, every object is recreated exactly where it was.
      • command jar -xvfM  /tmp/x.zip
        re-creates the objects with their directories in the current directory ( usually directory /home/user_name ).
  3. jar -tvf /tmp/x.zip
    This command displays the table of contents of the zipped file.