t
Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.

This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).

You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.

Title: jar
Language: Japanese
Date: 2013��11��21��
SectDesc: ����������
Software: JDK 8
Arch: ����
Part Number: E58103-01
Doc ID: JSSON

"jar" "1" "2013��11��21��" "JDK 8" "����������"
-----------------------------------------------------------------
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
"����"
jar - Java Archive (JAR)����������������������
"����"

JAR��������������

.\}

jar c[efmMnv0] [entrypoint] [jarfile] [manifest] [-C dir] file ... [-Joption ...] [@arg-file ...]
.\}

JAR��������������

.\}

jar u[efmMnv0] [entrypoint] [jarfile] [manifest] [-C dir] file ... [-Joption ...] [@arg-file ...]
.\}

JAR��������������

.\}

jar x[vf] [jarfile] file ... [-Joption ...] [@arg-file ...]
.\}

JAR����������������������������

.\}

jar t[vf] [jarfile] file ... [-Joption ...] [@arg-file ...]
.\}

JAR����������������������

.\}

jar i jarfile [-Joption ...] [@arg-file ...]
.\}
"����"

jar������������ZIP������ZLIB��������������������������������������������������������������jar��������������������������Java����������������������������������������������������������������������������������������������������������������������������������(����������������������������������)��1����������������������������������Java������������(������������)����������������������������1����HTTP������������������������������������������������������������������������������������������������������������������������������������������������������jar��������������������������������������������������������������������������������jar������������������������������������������������������������������������������������������������������������������������JAR������������������������������������������������������������������������������������������

jar������������������tar����������������������������������������������1����������������������������������������������������������������������������������������������������������������������������������������������

"����������"

jar��������������������������������������������������������������������������������������������������������������������1������������������������������������������������������������������������������������������

c

������JAR������������������������

i

JAR����������������������������������

t

JAR��������������������������������������

u

JAR������������������������

x

JAR������������������������������������

"����������"

��������������������������JAR������������������������������������������������������������������

e

entrypoint����������������������������������������JAR��������������������������������������Java��������������������������������������������������������������������������������������������������������Main-Class������������������������������������������e��������������JAR����������������(c)������������(u)���������������� ����������������������������Main.jar������������Main.class��������������������������������������������������������Main-Class��������Main����������������

.\}

jar cfe Main.jar Main Main.class
 
.\} Java Runtime Environment (JRE)������������������������������������������������������������������������������

.\}

java -jar Main.jar
 
.\} ������������������������������������������������������������������������(.)����������������(/)����������������������������������������������������Main.class��mydir������������������������������������������������������������������������������������������������

.\}

jar -cfe Main.jar mydir/Main mydir/Main.class
jar -cfe Main.jar mydir.Main mydir/Main.class
 
.\} .\}

.it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1

����

����
����������������������Main-Class������������������������m������������e������������������������������������Main-Class������������������������������������������������������������������jar����������������������������������������

f

jarfile��������������������������������������(c)������(u)������(x)����������(t)������JAR����������������������������f����������������jarfile������������������������jar������������stdin������JAR������������������������(x������t������)��JAR����������stdout��������������(c������u������)����������������

m

(META-INF/MANIFEST.MF������������������) jar����������������������������������manifest��������������������������������������������������������������������jar��������������������������������������������������������������������������JAR��������������������������������������������������������������jar��������������������������������m��������������JAR����������������(c)������������(u)���������������� ��������������������������������������������������������������������������������-��������������������������������������������������������������������������������������������������������������JAR��������������������������������������������������������������������������m����������������������http://docs.oracle.com/javase/tutorial/deployment/jar/index.html������ ������������������������������������������������������

M

��������������������������������������������(c������u������)��������������������������������������������������������������������(u������)��M��������������JAR����������������(c)������������(u)����������������

n

JAR��������������(c)������������������������������������pack200(1)������������������������������������������������������������������������������������������������������������������������JAR������������������������

v

��������������������������������������������������������

0

(����) ZIP������������������JAR��������������(c)����������(u)��������

-C dir

JAR��������������(c)����������(u)����������������������file��������������������������������������������������������������������������������������tar����������������-C������������������������������������������������������������������������������classes��������������������������������������������my.jar��Bar.class������������������������

.\}

jar uf my.jar -C classes Bar.class
 
.\} ������������������classes����������������������classes����������������������������������my.jar������������(JAR������������classes��������������������������)������������������������������������bin����������������������Xyz.class��my.jar��������������

.\}

jar uf my.jar -C classes . -C bin Xyz.class
 
.\} classes��bar1����������bar2��������������������������������������������������������JAR����������������������������������

.\}

% jar tf my.jar
META-INF/
META-INF/MANIFEST.MF
bar1
bar2
Xyz.class
 
.\}

-Joption

��������JVM��������������JRE��JAR������������������������������������������������JVM��������������java(1)������������������������������������������������������������-J-Xms48m����������������������������������������48MB����������������

"����������"

������������������jar������������������������

file

JAR��������������(c)����������(u)������file������������������������������������������������������������������������������������������������JAR��������������(x)������������������������(t)������file����������������������������������������������������������������������������1��������������������������������������������������������������������file������������������������������entrypoint��jarfile������manifest��������������������������������������file������������������������������������

entrypoint

JAR��������������(c)����������(u)������entrypoint����������������������JAR������������������������������������������Java��������������������������������������������������������������������e��������������������������entrypoint������������������������������������

jarfile

����(c)������(u)������(x)����������(t)��������������������������������f��������������������������jarfile������������������������������������f����������������jarfile������������������������jar������������stdin������JAR������������������������(x������t������)��JAR����������stdout��������������(c������u������)���������������� JAR������������������(i)������������f������������������������jarfile������������������������

manifest

JAR��������������(c)����������(u)������manifest������������JAR����������MANIFEST.MF����������������������������������������������������������������������f��������������������������manifest������������������������������������

@arg-file

jar����������������������������������������������������������������������������������������������������(@)��������jar������������������������������jar���������������������������������������������������������������������������������������������������������� ������������������jar��������������������������(������������������������������������������������-J����������������)��������������������������������������������������������������������������������������������������������������������jar������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(*)�������������������������������������� ����������find������������������������������������������������������classes.list����������������������������������

.\}

find . -name \*(Aq*.class\*(Aq -print > classes.list
 
.\} jar������������������@arg-file��������������classes.list������������������������������

.\}

jar cf my.jar @classes.list
 
.\} ����������������������������������������������������������������������������������������������������������������������������������jar����������������������������������������������������������������������������������

.\}

jar @dir/classes.list
 
.\}
"����"

e��f������m��������������entrypoint��jarfile������manifest����������������������������������������������������������

.\}

jar cmef myManifestFile MyMainClass myFile.jar *.class
 
.\}
"��"

�� 1 ��������������������������������������������������������������

.\}

% ls
1.au Animator.class monkey.jpg
2.au Wave.class spacemusic.au
3.au at_work.gif
 
% jar cvf bundle.jar *
added manifest
adding: 1.au(in = 2324) (out= 67)(deflated 97%)
adding: 2.au(in = 6970) (out= 90)(deflated 98%)
adding: 3.au(in = 11616) (out= 108)(deflated 99%)
adding: Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: at_work.gif(in = 6621) (out= 89)(deflated 98%)
adding: monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: spacemusic.au(in = 3079) (out= 73)(deflated 97%)
 
.\}

�� 2 ������������������������������������

.\}

% ls -F
audio/ classes/ images/
% jar cvf bundle.jar audio classes images
added manifest
adding: audio/(in = 0) (out= 0)(stored 0%)
adding: audio/1.au(in = 2324) (out= 67)(deflated 97%)
adding: audio/2.au(in = 6970) (out= 90)(deflated 98%)
adding: audio/3.au(in = 11616) (out= 108)(deflated 99%)
adding: audio/spacemusic.au(in = 3079) (out= 73)(deflated 97%)
adding: classes/(in = 0) (out= 0)(stored 0%)
adding: classes/Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: classes/Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: images/(in = 0) (out= 0)(stored 0%)
adding: images/monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: images/at_work.gif(in = 6621) (out= 89)(deflated 98%)
 
% ls -F
audio/ bundle.jar classes/ images/
 
.\}

�� 3 JAR��������������������

.\}

% jar tf bundle.jar
.\}

.\}

META-INF/
META-INF/MANIFEST.MF
audio/1.au
audio/2.au
audio/3.au
audio/spacemusic.au
classes/Animator.class
classes/Wave.class
images/monkey.jpg
images/at_work.gif
 
.\}

�� 4 ����������

����������������������������������������������main.jar��buy.jar������sell.jar��3����JAR������������������������i������������������������main.jar����������������Class-Path��������������������i����������������������������������������������������������������������������

.\}

Class-Path: buy.jar sell.jar
jar i main.jar
 
.\} INDEX.LIST����������META-INF��������������������������������������������������������������������������������������������������������������������������������������JAR�������������������������������������������� ����������������������������������������������������������������������������������������������������������������������������������������������������dir1��������������stdout����������������stdin����dir2����������������������������������(-f������������������jar��������������������)��

.\}

(cd dir1; jar c .) | (cd dir2; jar x)
 
.\}
"��������"

\h'-04'\(bu\h'+03'\c .\}

\(bu 2.3
.\} pack200(1).

\h'-04'\(bu\h'+03'\c .\}

\(bu 2.3
.\} http://docs.oracle.com/javase/tutorial/deployment/jar/index.html������ Java����������������JAR����������

'pl 8.5i 'bp