jdk/src/linux/doc/man/ja/jar.1
author mikejwre
Wed, 16 Jun 2010 15:48:53 -0700
changeset 5661 eda3e9ad64dc
parent 5506 202f599c92aa
child 5865 47da38a8c0f0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     1
." Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     2
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     3
."
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     4
." This code is free software; you can redistribute it and/or modify it
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     5
." under the terms of the GNU General Public License version 2 only, as
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     6
." published by the Free Software Foundation.
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     7
."
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     8
." This code is distributed in the hope that it will be useful, but WITHOUT
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     9
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    10
." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    11
." version 2 for more details (a copy is included in the LICENSE file that
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    12
." accompanied this code).
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    13
."
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    14
." You should have received a copy of the GNU General Public License version
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    15
." 2 along with this work; if not, write to the Free Software Foundation,
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    16
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    17
."
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    18
." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    19
." or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    20
." questions.
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    21
."
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    22
.TH jar 1 "04 May 2009"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    23
." Generated from HTML by html2man (author: Eric Armstrong)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    24
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    26
.SH "名前"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    27
jar \- Java ARchive ツール
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    28
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    29
\f3jar\fP は複数のファイルを 1 つの JAR アーカイブファイルに結合します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    30
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    31
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    32
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    33
形式 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    34
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    35
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    36
説明 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    37
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    38
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    39
オプション 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    40
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    41
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    42
コマンド行引数ファイル 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    43
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    44
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    45
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    46
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    47
o
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    48
関連項目 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    49
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    50
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    51
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    52
.SH "形式"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    56
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    58
JAR ファイルの作成 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
\f4jar c\fP\f2[v0Mmfe] [\fP\f2manifest\fP\f2] [\fP\f2jarfile\fP\f2] [\fP\f2entrypoint\fP\f2] [\-C\fP \f2dir\fP\f2]\fP \f2inputfiles\fP \f2[\-J\fP\f2option\fP\f2]\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    61
JAR ファイルの更新 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
\f4jar u\fP\f2[v0Mmfe] [\fP\f2manifest\fP\f2] [\fP\f2jarfile\fP\f2] [\fP\f2entrypoint\fP\f2] [\-C\fP \f2dir\fP\f2]\fP \f2inputfiles\fP \f2[\-J\fP\f2option\fP\f2]\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    64
JAR ファイルの抽出 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
\f4jar x\fP\f2[vf] [\fP\f2jarfile\fP\f2] [\fP\f2inputfiles\fP\f2] [\-J\fP\f2option\fP\f2]\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    67
JAR ファイルの内容の表形式による一覧表示 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
\f4jar t\fP\f2[vf] [\fP\f2jarfile\fP\f2] [\fP\f2inputfiles\fP\f2] [\-J\fP\f2option\fP\f2]\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    70
JAR ファイルへのインデックスの追加 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
\f4jar i\fP \f2jarfile\fP \f2[\-J\fP\f2option\fP\f2]\fP 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    72
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    73
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    76
説明
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    81
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
cuxtiv0Mmfe 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    84
\f2jar\fP コマンドを制御するオプション 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    86
jarfile 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    87
作成 (\f2c\fP)、更新 (\f2u\fP)、抽出 (\f2x\fP)、または内容の一覧表示 (\f2t\fP) の対象となる JAR ファイル。\f2f\fP オプションとファイル名 \f2jarfile\fP とがペアになります。 つまり、片方を記述すれば、もう一方も記述する必要があります。\f2f\fP と \f2jarfile\fP を省略すると、標準入力から「JAR ファイル」が取得されるか (x および t の場合)、標準出力へ「JAR ファイル」が送信されます(c および u の場合)。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    89
inputfiles 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    90
\f2jarfile\fP に結合されるか (c および u の場合)、\f2jarfile\fP から抽出 (x の場合) または一覧表示 (t の場合) される、空白で区切られたファイルまたはディレクトリ。すべてのディレクトリは再帰的に処理されます。このファイルは、オプション \f2O\fP (ゼロ) を使用しないかぎり圧縮されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    92
manifest 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    93
\f2name\fP\f2:\fP\f2value\fP のペアが、JAR ファイルの MANIFEST.MF に含まれている既存のマニフェストファイル。\f2\-m\fP オプションとファイル名 \f2manifest\fP とがペアになります。 つまり、片方を記述すれば、もう一方も記述する必要があります。\f3m\fP、\f3f\fP、および \f3e\fP の出現順序は、\f2manifest\fP、\f2jarfile\fP、\f2entrypoint\fP の出現順序と一致する必要があります。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    94
.TP 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
entrypoint 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    96
実行可能 JAR ファイル内にバンドルされたスタンドアロンアプリケーションのアプリケーションエントリポイントとして設定するクラスの名前。\f2\-e\fP オプションと entrypoint は対になっています。 どちらかを指定する場合は両方とも指定する必要があります。\f3m\fP、\f3f\fP、および \f3e\fP の出現順序は、\f2manifest\fP、\f2jarfile\fP、\f2entrypoint\fP の出現順序と一致する必要があります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
\-C\ dir 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    99
これに続く \f2inputfiles\fP 引数を処理する間、ディレクトリを \f2dir\fP へ一時的に変更します。\f2\-C\ \fP\f2dir\fP \f2inputfiles\fP のセットは複数使用できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
\-Joption 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   102
Java 実行環境へ渡されるオプション。\f2\-J\fP と \f2option\fP の間には空白を入れないでください。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   103
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   104
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   105
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   106
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   107
.SH "説明"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   108
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   109
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   110
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   111
\f3jar\fP ツールは、複数のファイルを 1 つの JAR アーカイブファイルに結合します。 \f3jar\fP は、ZIP および 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   112
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   113
\f2ZLIB\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   115
http://www.gzip.org/zlib/ 圧縮形式をベースにした、汎用のアーカイブおよび圧縮ツールです。ただし \f3jar\fP ツールの主な目的は、いくつかの Java アプレットやアプリケーションを 1 個のアーカイブに統合することです。アプレットやアプリケーションのコンポーネント (ファイル、イメージ、およびサウンド) が 1 つのアーカイブに結合されていると、Java エージェント (ブラウザなど) は、それらのコンポーネントを 1 回の HTTP トランザクションでダウンロードすることができ、コンポーネントごとに新しい接続を必要とすることがありません。これによって、ダウンロードの回数が大幅に減ります。 また、\f3jar\fP はファイルを圧縮するので、ダウンロード時間も短くなります。また、ファイル内の個々のエントリにアプレット作成者による署名を書き込めるので、配布元の認証が可能になります。jar ツールの構文は、\f2tar\fP コマンドの構文とほぼ同じです。\f3JAR\fP アーカイブは、圧縮されているかどうかにかかわらず、クラスパスのエントリとして使用できます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   116
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   117
複数のファイルを JAR ファイルへ結合する一般的な使用法は次のとおりです。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   118
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   119
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   120
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   121
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   122
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   123
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   124
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   125
% jar cf myFile.jar *.class
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   126
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   127
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   130
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   132
この例では、現在のディレクトリにあるクラス (.class) ファイルがすべて、\f2myFile.jar\fP という名前のファイルに格納されます。jar ツールは自動的に、\f2META\-INF/MANIFEST.MF\fP という名前のマニフェストファイルエントリを生成します。これは常に、JAR ファイルの最初のエントリになります。マニフェストファイルは、アーカイブに関するメタ情報を宣言し、そのデータを \f2name\ :\ value\fP ペアとして格納します。jar ツールがマニフェストファイル内にメタ情報を格納する方法の詳細については、「
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   133
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   134
\f2JAR file specification\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   136
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest」を参照してください。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   138
既存のマニフェストファイル内に格納された \f2name\ :\ value\fP ペアを JAR ファイルに含める必要がある場合には、そのファイルを次のように \f2\-m\fP オプションを使って指定します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
% jar cmf myManifestFile myFile.jar *.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   153
既存のマニフェストファイルは改行文字で終わっている必要があります。 マニフェストファイルが改行文字で終わっていない場合、\f3jar\fP はその最後の行を解析しません。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   160
\f3注:\ \fPコマンド行に \f2cmf\fP ではなく \f2cfm\fP が指定された jar コマンド (m と \-f オプションの順番を逆にする) の場合、\f3jar\fP コマンド行にまず JAR アーカイブの名前を指定し、続いてマニフェストファイルの名前を指定する必要があります。 次に例を示します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   161
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   162
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   164
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   165
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   166
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   167
% jar cfm myFile.jar myManifestFile *.class
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   168
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   169
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   170
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   172
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   174
マニフェストは、RFC822 ASCII 形式で規定されたテキスト形式であるため、マニフェストファイルの内容を簡単に表示および編集できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   176
JAR ファイルからファイルを抽出する場合は、\f2x\fP を使用します。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   177
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   178
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   179
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   181
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   182
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   183
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   184
% jar xf myFile.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   185
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   186
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   188
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   189
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   190
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   191
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   192
jar ファイルから個別のファイルを抽出する場合は、そのファイル名を指定します。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   193
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   194
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   195
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   196
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   197
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   198
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   199
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   200
% jar xf myFile.jar foo bar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   201
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   202
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   203
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   204
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   205
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   206
.LP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   208
Java 2 SDK のバージョン 1.3 以降から、\f2jar\fP ユーティリティーで 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   209
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   210
\f2JarIndex\fP @
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   211
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   212
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JARIndex がサポートされています。 JarIndex を使用すると、アプリケーションのクラスローダーで JAR ファイルからクラスがロードされるときの効率が向上します。アプリケーションまたはアプレットが複数の JAR ファイルにバンドルされている場合は、クラスがロードされるときに、必要な JAR ファイル以外のダウンロードおよびオープンは行われません。このパフォーマンスの最適化は、新しい \f2\-i\fP オプションを指定して \f2jar\fP を実行すると有効になります。このオプションを使うと、指定した JAR メインファイルとそのメインファイルが依存しているすべての JAR ファイルについて、パッケージ位置情報が生成されます。 メインファイルが依存している JAR ファイルは、JAR メインファイルのマニフェストの \f2Class\-Path\fP 属性に指定しておく必要があります。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   213
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   214
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   215
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   217
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   218
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   219
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   220
% jar i main.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   221
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   222
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   223
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   224
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   225
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   226
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   227
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   228
この例では、\f2INDEX.LIST\fP ファイルが \f2main.jar\fP の \f2META\-INF\fP ディレクトリに挿入されます。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   229
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   230
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   231
このファイルに格納されている情報を使用して、アプリケーションのクラスローダーは、効率的にクラスをロードします。 インデックスファイルに位置情報を格納する方法の詳細は、 「\f2JarIndex\fP 仕様」を参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
.br
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   234
ディレクトリをコピーするには、まず \f2dir1\fP 内のファイルを圧縮して標準出力に出力し、続いて標準入力から \f2dir2\fP に抽出します (両方の \f2jar\fP コマンドから \f2\-f\fP オプションを省く)。 次に例を示します。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   235
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   236
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   237
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   239
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   240
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   241
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
% (cd dir1; jar c .) | (cd dir2; jar x)
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   243
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   244
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   245
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   247
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   249
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   250
\f2jar\fP を使って JAR ファイルや JAR ファイルマニフェストを操作するコマンドサンプルを確認するには、「例」を参照してください。また、「
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
.na
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   252
\f2Java Tutorial\fP @
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   253
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   254
http://java.sun.com/docs/books/tutorial/jar」の JAR コースも参照してください。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   255
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   256
.SH "オプション"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   257
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   258
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   259
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   260
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   261
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   262
c 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   263
\f2jarfile\fP の名前で新しいアーカイブファイルを作成するか (\f2f\fP が指定されている場合)、標準出力で作成します (\f2f\fP と \f2jarfile\fP が省略されている場合)。\f2inputfiles\fP で指定されたファイルとディレクトリを、このアーカイブに追加します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   264
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   265
u 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   266
\f2inputfiles\fP で指定されたファイルとディレクトリを追加することにより、既存のファイル \f2jarfile\fP を更新します (\f2f\fP が指定されている場合)。 例を示します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   267
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   268
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   270
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   271
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   272
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   273
jar uf foo.jar foo.class
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   274
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   275
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   276
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   278
上のコマンドは、ファイル \f2foo.class\fP を既存の JAR ファイル \f2foo.jar\fP に追加します。次の例に示すように、\f2\-u\fP オプションは、マニフェストエントリも更新できます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   279
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   280
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   282
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   283
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   284
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   285
jar umf manifest foo.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   286
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   287
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   288
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   289
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   290
\f2foo.jar\fP マニフェストをマニフェスト内の \f2name:value\fP ペアで更新します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   291
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   292
x 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   293
\f2jarfile\fP から (\f2f\fP が指定されている場合)、または標準入力から (\f2f\fP と \f2jarfile\fP が省略されている場合)、ファイルとディレクトリを抽出します。\f2inputfiles\fP が指定されている場合は、その指定したファイルとディレクトリだけが抽出されます。指定されていなければ、すべてのファイルとディレクトリが抽出されます。抽出されたファイルの日時は、アーカイブ内で設定されたものです。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   294
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   295
t 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   296
\f2jarfile\fP から (\f2f\fP が指定されている場合)、または標準入力から (\f2f\fP と \f2jarfile\fP が省略されている場合)、内容を表形式で一覧表示します。\f2inputfiles\fP が指定されている場合は、その指定したファイルとディレクトリだけが一覧表示されます。指定されていなければ、すべてのファイルとディレクトリが一覧表示されます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   297
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   298
i 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   299
指定された \f2jarfile\fP と、それに依存する JAR ファイルについて、インデックス情報を生成します。例を示します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   300
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   301
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   303
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   304
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   305
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   306
jar i foo.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   307
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   308
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   309
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   312
上のコマンドは、\f2foo.jar\fP 内に \f2INDEX.LIST\fP ファイルを生成します。 このファイルには、\f2foo.jar\fP と、\f2foo.jar\fP の \f2Class\-Path\fP 属性に指定されたすべての JAR ファイルに入っている各パッケージの位置情報が書き込まれています。 インデックスの例を参照してください。   
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   313
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   314
f 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   315
作成 (\f2c\fP)、更新 (\f2u\fP)、抽出 (\f2x\fP)、インデックス追加 (\f2i\fP)、または表示 (\f2t\fP) 対象のファイル \f2jarfile\fP を指定します。\f2f\fP オプションとファイル名 \f2jarfile\fP とがペアになります。 つまり、片方を記述すれば、もう一方も記述する必要があります。\f2f\fP と \f2jarfile\fP を省略すると、標準入力から JAR ファイル名が使用されたり (x および t の場合)、標準出力に jar ファイルが 送信されたりします (c および u の場合)。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   316
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   317
v 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   318
詳細な出力を標準出力に生成します。あとで例を示します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   319
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   320
0 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   321
(ゼロ) ZIP による圧縮を使用せずに、保存します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   322
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   323
M 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   324
マニフェストファイルエントリを作成しません (c および u の場合)。 または、マニフェストファイルエントリが存在する場合にそれを削除します (u の場合)。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   325
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   326
m 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   327
\f2META\-INF/MANIFEST.MF\fP のファイルで指定したマニフェストファイル \f2manifest\fP の \f2name :value\fP の属性ペアを組み込みます。すでに同じ名前で存在しない限り、 \f2jar\fP はその \f2name\ :\ value\fP ペアを追加します。同じ名前で存在する場合は、\f2jar\fP はその値を更新します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   329
コマンド行で、\f3m\fP と \f3f\fP の文字は、\f2manifest\fP と \f2jarfile\fP の入力順序と同じ順序で記述する必要があります。たとえば、次のようにして使います。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   330
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   331
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   333
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   334
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   335
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   336
jar cmf myManifestFile myFile.jar *.class
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   337
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   338
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   339
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   341
デフォルトのマニフェストには含まれないマニフェストに、特別な目的の \f2name\ :\ value\fP の属性ペアを追加できます。たとえば、ベンダー情報、バージョン情報、パッケージシーリング、または JAR にバンドルされたアプリケーションを実行するための属性を追加できます。\f4\-m\fP オプションの使用例については、「Java Tutorial」 にある「
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   342
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   343
\f2JAR Files\fP @
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   344
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   345
http://java.sun.com/docs/books/tutorial/jar/」コースを参照してください。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
e 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   349
実行可能 JAR ファイル内にバンドルされたスタンドアロンアプリケーションのアプリケーションエントリポイントとして、\f2entrypoint\fP を設定します。このオプションを使用すると、マニフェストファイル内の \f2Main\-Class\fP 属性値が作成または上書きされます。 このオプションは、JAR ファイルの作成中または更新中に使用できます。 このオプションを使えば、マニフェストファイルを編集または作成することなしに、アプリケーションのエントリポイントを指定できます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
.br
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   352
たとえば、次のコマンドは \f2Main.jar\fP を作成しますが、その際、マニフェストファイル内の \f2Main\-Class\fP 属性値は \f2Main\fP に設定されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
jar cfe Main.jar Main Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   365
次のコマンドを実行すると java ランタイムから直接このアプリケーションを起動できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
java \-jar Main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   377
エントリポイントのクラス名が特定のパッケージ内に存在している場合、エントリポイントの区切り文字としてドット (「.」) またはスラッシュ (「/」) を使用できます。たとえば、\f2Main.class\fP が \f2foo\fP という名前のパッケージ内に存在している場合、次のようにしてエントリポイントを指定できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
jar \-cfe Main.jar foo/Main foo/Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   389
または 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
jar \-cfe Main.jar foo.Main foo/Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   401
\f3注:\ \fP \f2\-m\fP オプションと \f2\-e\fP オプションの両方を同時に指定する場合、指定されたマニフェストにも \f2Main\-Class\fP 属性が含まれていると、\f2Main.class\fP の指定があいまいになってエラーが発生し、JAR の作成または更新処理が異常終了します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   402
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   403
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   404
\-C \ dir 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   405
\f2jar\fP コマンドの実行中に後続の \f2inputfiles\fP 引数を処理するときに、一時的にディレクトリを変更します (\f2cd\fP\ \f2dir\fP)。この処理は、UNIX の \f2tar\fP ユーティリティーの \f2\-C\fP オプションの機能に類似しています。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   406
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   407
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   408
たとえば、次のコマンドは、\f2classes\fP ディレクトリに移動し、そのディレクトリから \f2bar.class\fP を \f2foo.jar\fP に追加します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
jar uf foo.jar \-C classes bar.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   420
次のコマンドでは、\f2classes\fP ディレクトリに移動し、\f2classes\fP ディレクトリ内のすべてのファイルを \f2foo.jar\fP に追加します (jar ファイルには classes ディレクトリを作成しません)。 次に元のディレクトリに戻ってから、\f2bin\fP ディレクトリに移動し、\f2xyz.class\fP を \f2foo.jar\fP に追加します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
jar uf foo.jar \-C classes . \-C bin xyz.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   432
\f2classes\fP に \f2bar1\fP と \f2bar2\fP が保持されている場合、\f2jar tf foo.jar\fP を使用すると、JAR ファイルには次の要素が含められます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   433
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   434
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
.nf
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   437
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   438
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   439
META\-INF/
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   440
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   441
META\-INF/MANIFEST.MF
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   442
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
bar1
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   444
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
bar2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   446
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
xyz.class
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   448
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   449
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   453
.TP 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   454
\-Joption 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   455
Java 実行環境に \f2option\fP を渡します。 \f2option\fP には、「Java アプリケーション起動ツール」のリファレンスページに記載されているオプションを 1 つ指定します。たとえば、\f4\-J\-Xmx48M\fP と指定すると、最大メモリーは 48M バイトに設定されます。\f2\-J\fP を使って背後の実行環境にオプションを渡すことはよく行われています。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   457
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   458
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   459
.SH "コマンド行引数ファイル"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   460
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   461
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   462
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   463
jar のコマンド行を短くしたり簡潔にしたりするために、\f2jar\fP コマンドに対する引数 (\f2\-J\fP オプションを除く) を含む 1 つ以上のファイルを指定することができます。これにより、任意の長さの jar コマンドを作成でき、オペレーティングシステムによるコマンド行の制限から解放されます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   464
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   465
引数ファイルにはオプションとファイル名を含めることができます。ファイル内の各引数は、スペースまたは改行で区切ります。引数ファイル内のファイル名は、現在のディレクトリから見た相対パスになります。 引数ファイルの位置から見た相対パスではありません。ワイルドカード (*) は、通常ならばオペレーティングシステムシェルによってあらゆる文字に解釈されますが、この場合はそのようには解釈されません。引数ファイル内の引数で \f2@\fP 文字を使用して、複数のファイルを再帰的に解釈することはサポートされていません。また、\f2\-J\fP オプションもサポートされていません。 このオプションは起動ツールに渡されますが、起動ツールでは引数ファイルをサポートしていないからです。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   466
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   467
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   468
\f2jar\fP を実行するときに、各引数ファイルのパスとファイル名の先頭に \f2@\fP 文字を付けて渡します。\f2jar\fP は、\f2@\fP 文字で始まる引数を見つけると、そのファイルの内容を展開して引数リストに挿入します。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   469
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   470
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   471
次の例では、\f2find\fP コマンドから出力されたファイル名を \f2classes.list\fP 内に格納しています。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   472
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   473
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   474
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   475
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   476
.nf
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
\f3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   478
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   479
% find \fP\f3.\fP \-name '*.class' \-print > classes.list
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   480
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   481
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   482
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   483
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   484
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   485
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   486
その後、引数ファイル構文を使って \f2jar\fP にリストを渡すと、\f2Classes.list\fP で \f2jar\fP コマンドを実行できます。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   487
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   488
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   489
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   491
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   492
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   493
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   494
% jar cf my.jar @classes.list
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   495
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   496
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   497
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   498
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   499
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   500
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   501
引数ファイルはパスを指定できますが、相対パスが記述された引数ファイル内のすべてのファイル名は、渡されたパスに対して相対的ではなく、現在の作業ディレクトリに相対的となります。 次に例を示します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   502
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   503
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   504
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   505
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   506
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   507
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   508
% jar @path1/classes.list
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   509
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   510
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   513
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   514
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   515
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   516
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   517
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   518
.SH "例"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   519
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   520
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   521
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   522
特定のディレクトリ内のすべてのファイルをアーカイブに追加する (そのアーカイブがすでに存在する場合は、その内容を上書きする) には、次のようにします。\f2\-v\fP オプションを使用して情報を詳細に列挙するように指定すると、サイズや最新の更新日など、アーカイブ内のファイルについての詳細情報が表示されます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   523
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   524
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   525
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   526
.nf
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
\f3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   528
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   529
% ls
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   530
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   531
1.au          Animator.class    monkey.jpg
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   532
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   533
2.au          Wave.class        spacemusic.au
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   534
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   535
3.au          at_work.gif
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   536
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   538
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   539
% jar cvf bundle.jar *
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   540
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
added manifest
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   542
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   543
adding: 1.au(in = 2324) (out= 67)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   544
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   545
adding: 2.au(in = 6970) (out= 90)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   546
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   547
adding: 3.au(in = 11616) (out= 108)(deflated 99%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   548
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   549
adding: Animator.class(in = 2266) (out= 66)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   550
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   551
adding: Wave.class(in = 3778) (out= 81)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   552
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   553
adding: at_work.gif(in = 6621) (out= 89)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   554
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   555
adding: monkey.jpg(in = 7667) (out= 91)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   556
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   557
adding: spacemusic.au(in = 3079) (out= 73)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   558
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   559
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   562
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   563
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   564
すでに画像、オーディオファイル、およびクラス用のサブディレクトリに分けている場合は、これらを単一の JAR ファイルに結合できます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   565
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   566
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   567
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   568
.nf
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
\f3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   570
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   571
% ls \-F
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   572
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   573
audio/ classes/ images/
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   574
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   575
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   576
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   577
% jar cvf bundle.jar audio classes images
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   578
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   579
added manifest
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   580
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   581
adding: audio/(in = 0) (out= 0)(stored 0%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   582
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   583
adding: audio/1.au(in = 2324) (out= 67)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   584
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   585
adding: audio/2.au(in = 6970) (out= 90)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   586
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   587
adding: audio/3.au(in = 11616) (out= 108)(deflated 99%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   588
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   589
adding: audio/spacemusic.au(in = 3079) (out= 73)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   590
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   591
adding: classes/(in = 0) (out= 0)(stored 0%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   592
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   593
adding: classes/Animator.class(in = 2266) (out= 66)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   594
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   595
adding: classes/Wave.class(in = 3778) (out= 81)(deflated 97%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   596
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   597
adding: images/(in = 0) (out= 0)(stored 0%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   598
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   599
adding: images/monkey.jpg(in = 7667) (out= 91)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   600
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   601
adding: images/at_work.gif(in = 6621) (out= 89)(deflated 98%)
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   602
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   603
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   604
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   605
% ls \-F
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   606
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   607
audio/ bundle.jar classes/ images/
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   608
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   609
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   610
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   611
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   612
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   613
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   614
JAR ファイルのエントリ名を表示するには、「\f2t\fP」オプションを使用します。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   615
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   616
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   617
.LP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
.nf
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   619
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   620
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
% jar tf bundle.jar
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   622
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   623
META\-INF/
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   624
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   625
META\-INF/MANIFEST.MF
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   626
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
audio/1.au
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   628
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
audio/2.au
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   630
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
audio/3.au
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   632
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
audio/spacemusic.au
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   634
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
classes/Animator.class
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   636
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
classes/Wave.class
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   638
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
images/monkey.jpg
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   640
.fl
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
images/at_work.gif
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   642
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   643
\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   646
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   647
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   648
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   649
クラスロードを高速にするためにインデックスファイルを JAR ファイルに追加するには、「\f2i\fP」オプションを使用します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
.br
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   652
例:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   659
たとえば、株取引アプリケーション用の相互依存したクラスを、\f2main.jar\fP、\f2buy.jar\fP、および \f2sell.jar\fP という 3 つの JAR ファイルに分割したとします。
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   660
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   661
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   662
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   663
.br
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   664
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   666
\f2main.jar\fP のマニフェストの \f2Class\-path\fP 属性に次のように指定した場合、 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   667
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   668
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   669
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   670
Class\-Path: buy.jar sell.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   671
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   672
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   673
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   674
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   675
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   676
\f2\-i\fP オプションを使用すれば、アプリケーションのクラスの 読み込みを高速化できます。 
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   677
.nf
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   678
\f3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   679
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   680
% jar i main.jar
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   681
.fl
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   682
\fP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   683
.fi
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   684
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   685
.LP
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   686
\f2INDEX.LIST\fP ファイルが \f2META\-INF\fP ディレクトリに挿入されます。この結果、アプリケーションのクラスローダーによってクラスまたは リソースの検索が行われるときに、適切な jar ファイルがダウンロードされます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
.RE
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   688
.SH "関連項目"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   692
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   693
\f2「JAR ファイルの概要」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
http://java.sun.com/javase/6/docs/technotes/guides/jar/jarGuide.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   699
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   700
\f2「JAR ファイルの仕様」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   706
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   707
\f2「Jar インデックス」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   709
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JARIndex
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   713
.na
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   714
\f2「Jar チュートリアル」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   716
http://java.sun.com/docs/books/tutorial/jar (Java Software の Web サイト内)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   720
pack200(1) 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722