jdk/src/linux/doc/man/ja/jar.1
author jjg
Tue, 11 Mar 2008 13:14:55 -0700
changeset 168 25697c18650b
parent 2 90ce3da70b43
child 2692 345bc8d65b19
permissions -rw-r--r--
6307187: clean up code for -Xlint:options Summary: introduce common code for handling one-of and any-of options Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
'\" t
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
.\" Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
.\" This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
.\" under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
.\" published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
.\" This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
.\" version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
.\" accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
.\" You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
.\" 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
.\" Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
.\" CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
.\" have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
.\" `
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
.TH jar 1 "2006 年 9 月 4 日" "Java SE 6" "ユーザーコマンド"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
.SH "名前"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
jar \- Java アーカイブツール
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
\f3jar\fP は複数のファイルを 1 つの Java Archive (JAR) ファイルに結合します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
.\" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
.\"  This document was created by saving an HTML file as text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
.\"  from the JavaSoft web site:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
.\" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
.\" http://java.sun.com/j2se/1.5/docs/tooldocs/tools.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
.\" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
.\"  and adding appropriate troff macros.  Because the JavaSoft web site 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
.\"  man pages can change without notice, it may be helpful to diff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
.\"  files to identify changes other than new functionality. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
.\" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
.SH "形式"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
jar ファイルの作成 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
\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
    47
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
jar ファイルの更新 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
\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
    50
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
jar ファイルの抽出 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
\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
    53
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
jar ファイルの内容の一覧を作成
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
\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
    56
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
jar ファイルにインデックスを追加
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
\f4jar i\fP \f2jarfile\fP \f2[\-J\fP\f2option\fP\f2]\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
パラメータ
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
cuxtiv0Mmfe 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
.I jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
コマンドを制御するオプション。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
作成 (c)、更新 (u)、抽出 (x)、または閲覧される内容の一覧を作成 (t) する
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
jar ファイルです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
.I \-f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
オプションとファイル名
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
は対になっています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
使用する場合は、両方を一緒に使用します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
および 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
を省略すると、標準入力から「jar ファイル」が
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
使用されたり (x および t の場合)、標準出力にこの「jar ファイル」が
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
送信されたりします (c および u の場合)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
inputfiles 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
.I jar ファイル
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
に結合 (c および u の場合)、または 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
.I jar ファイル
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
から抽出 (x の場合) または一覧表示 (t の場合) されるファイル
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
またはディレクトリ。空白文字で区切ります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
すべてのディレクトリは再帰的に処理されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
オプション 0 (ゼロ) が使用されない場合は、ファイルが圧縮されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 manifest 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
jar ファイルの MANIFEST.MF に含めようとする名前:値ペアが含まれている
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
既存の manifest ファイルです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
.I \-m 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
オプションと
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
.I manifest 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
のファイル名は対になっています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
使用する場合は、両方を一緒に使用します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
文字 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
.B m 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
.B f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
、および 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
.B e 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
の出現順序は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
.I manifest 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
、および 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
.I entrypoint 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
の出現順序と一致する必要があります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
entrypoint 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
実行可能 JAR ファイル内にバンドルされたスタンドアロンアプリケーションのアプリケーションエントリポイントとして設定するクラスの名前。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
.I \-e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
オプションと entrypoint は対になっています。どちらかを指定する場合は両方とも指定する必要があります。文字 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
.I m
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
.I f
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
.I e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
の出現順序は 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
.I manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
.I jarfile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
.I entrypoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
の出現順序と一致する必要があります。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
\-C\ dir 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
後続の入力ファイル引数の処理中、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
ディレクトリを 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
.I dir 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
に一時的に変更します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
複数の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
.I \-C " dir" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
入力ファイルのセットを使用できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
\-Joption 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
Java Runtime Environment に渡されるオプション
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
.I \-J 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.I option 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
の間には空白文字を入れないでください)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
.SH "機能説明"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
.IX "Java archive tool" "" "Java archive tool \(em \fLjar\fP"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
.IX "jar" "" "\fLjar\fP \(em Java archive tool"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
.B jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
ツールは
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
Java 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
アプリケーションの
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
つで、複数個のファイルを
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
個の
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
JAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
アーカイブファイルに統合します。また、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
jar は汎用的なアーカイブ作成用
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
および圧縮用のツールでもあり、圧縮は
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
.SM ZIP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
または
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
.I ZLIB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 (http://www.gzip.org/zlib/) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
形式で行います。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
ただし
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
.B jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
ツールの主な目的は、いくつかの
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
アプレットやアプリケーションを
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
個のアーカイブに統合することです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
アプレットやアプリケーションのコンポーネント、たとえば
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
クラスファイル、イメージ、サウンドなどを単一のアーカイブに
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
まとめると、ブラウザのような
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
エージェントにダウンロードするときに、一度の
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
HTTP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
トランザクションで済みます。コンポーネントごとに
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
新たに接続する必要がありません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
これによりダウンロード時間が大幅に短縮できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
また
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
.B jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
はファイルの圧縮も行うので、ダウンロードがより高速になります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
さらに、ファイル中の個々のエントリに対してアプレットの作成者が
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
署名できるので、作成元を明確化できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
.B jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
ツールの構文は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
.I tar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
コマンドの構文とほぼ同一です。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
.B jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
アーカイブは、圧縮されているかどうかにかかわらず、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
クラスパス
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 (http://java.sun.com/javase/6/docs/technotes/tools/solaris/classpath.html) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
エントリとして使用できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
複数のファイルを jar ファイルに統合する標準的な使い方は次のとおりです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
.RS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
.ft 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
% jar cf myFile.jar *.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
.ft 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
この例では、現在のディレクトリ中のすべてのクラスファイルが
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.I myFile.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
という名前のファイルに置かれます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
jar ツールは自動的に、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
.I META\-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
という名前のマニフェストファイルエントリを生成します。これは常に、JAR ファイルの最初のエントリになります。マニフェストファイルは、アーカイブに関するメタ情報を宣言し、そのデータを
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
.I name : value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
ペアとして格納します。jar ツールがマニフェストファイル内にメタ情報を格納する方法の詳細については、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
「JAR file specification」を参照してください。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
既存のマニフェストファイル内に格納された 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
.I name : value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
ペアを JAR ファイルに含める必要がある場合には、そのファイルを次のように \f2\-m\fP オプションを使って指定します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
% jar cmf myManifestFile myFile.jar *.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
既存のマニフェストファイルは改行文字で終わっている必要があります。\  マニフェストファイルが改行文字で終わっていない場合、\f3jar\fP はその最後の行を解析しません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
\f3注:\ \fP コマンド行に 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
.I cmf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
ではなく 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
.I cfm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
が指定された jar コマンド (m と \-f オプションの順番を逆にする) の場合、\f3jar\fP コマンド行にまず jar アーカイブの名前を指定し、続いてマニフェストファイルの名前を指定する必要があります。次に例を示します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
.B % jar cfm myFile.jar myManifestFile *.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
manifest は RFC822 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
.SM ASCII 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
形式に基づいたテキスト形式を使用するため、manifest ファイルの内容は
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
簡単に表示および処理できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
jar ファイルからファイルを抽出する場合は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
.I x 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
を使用します。次に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
% jar xf myFile.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
jar ファイルから個別のファイルを抽出する場合は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
そのファイル名を指定します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
% jar xf myFile.jar foo bar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
JDK のバージョン 1.3 から、jar ユーティリティで 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
の「
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
.I JarIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
」をサポートするようになりました。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
これにより、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
アプリケーションのクラスローダは、jar ファイルから
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
クラスをより高速に読み込めるようになりました。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
アプリケーションまたはアプレットが複数の jar ファイルに
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
バンドルされている場合、必要な jar ファイルだけがダウン
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
ロードされて開かれ、クラスが読み込まれます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
このパフォーマンスの最適化は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
.I \-i
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
オプションを使用して実行すると有効になります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
指定した
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
メインの jar ファイルおよびそのファイルが依存している
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
すべての jar ファイルのパッケージ位置情報が生成されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
これらの情報は、メイン jar ファイルの manifest の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
.I Class-Path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
属性で
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
指定する必要があります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
% jar i main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
この例では、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
.I INDEX.LIST 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
ファイルが 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
.I main.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
.I META-INF ディレクトリに追加されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
アプリケーションのクラスローダでは、このファイルに格納された情報を
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
使用して、クラスのロードを高速化します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
インデックスファイルに位置情報を格納する方法の詳細は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
「JarIndex 仕様」を参照してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
ディレクトリをコピーするには、まず 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
.I dir1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
内のファイルを圧縮して標準出力に出力し、続いて標準入力から 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
.I dir2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
に抽出します (両方の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
コマンドから
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
.I \-f
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
オプションを省く)。次に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
% (cd dir1; jar c .) | (cd dir2; jar x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
を使って JAR ファイルや JAR ファイルマニフェストを操作するコマンドサンプルを確認するには、「例」を参照してください。また、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
http://java.sun.com/docs/books/tutorial/jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
「Java Tutorial」の JAR コースも参照してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
.SH "オプション"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
.B c
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
新規のアーカイブファイルを 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
という名前 (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
を指定した場合)、または標準出力上に (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
を省略した場合) 作成します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
アーカイブには入力ファイルで指定したファイルおよびディレクトリが追加されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
.B u
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
既存の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
を指定した場合) を更新します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
このとき、この 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
には入力ファイルで指定されたファイルおよびディレクトリが追加されます。以下に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
% jar uf foo.jar foo.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
この例では、ファイル 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
.I foo.class 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
が既存の jar ファイル 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
に追加されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
.I u 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
オプションでは、マニフェストのエントリを更新することもできます。以下に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
% jar umf manifest foo.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
マニフェストをマニフェスト内の名前:値ペアで更新します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
.B x
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
ファイルおよびディレクトリを 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
を指定した場合)、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
または標準入力 (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
を省略した場合) から抽出します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
入力ファイルを指定した場合、その入力ファイルで指定されたファイルおよびディレクトリだけが
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
抽出されます。指定しない場合は、すべてのファイルおよびディレクトリが抽出されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
抽出されたファイルの日時は、アーカイブ内で設定されたものです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
.B t
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
を指定した場合)、または標準入力 (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
を省略した場合) から内容をリストします。入力ファイルを指定した場合、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
その入力ファイルで指定されたファイルおよびディレクトリだけが
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
リストされます。指定しない場合は、すべてのファイルおよびディレクトリがリストされます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
.B i
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
指定された 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
および関連づけられている jar ファイルの
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
インデックス情報を生成します。次に例を示します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
% jar i foo.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
.I foo.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
.I INDEX.LIST 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
ファイルが生成されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
このファイルには、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
の各パッケージおよび 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
.I Class-Path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
属性に指定されているすべての jar ファイルの
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
位置情報が書き込まれています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
インデックスの例を参照してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
.B f
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
作成 (c)、更新 (u)、抽出 (x)、インデックス作成(i)、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
または表示 (t) する 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
を指定します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
.I \-f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
オプションと 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
のファイル名は対になっています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
使用する場合は、両方を一緒に使用します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
.I f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
.I jarfile 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
を省略すると、標準入力から jar ファイル名が
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
使用されたり (x および t の場合)、標準出力に jar ファイルが
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
送信されたりします (c および u の場合)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
.B v
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
標準出力に詳細な出力を生成します。次に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
.B 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
ゼロ。ZIP 圧縮を使用せずに格納します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
.B M
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
manifest ファイルエントリを作成しません (c および u の場合)。または
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
すでに存在する manifest ファイルエントリを削除します (u の場合)。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
.B m
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
指定したマニフェストファイル 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
.I manifest 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
から
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
名前:値属性をファイル
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
.I META-INF/MANIFEST.MF 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
に取り込みます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
すでに同じ名前で存在しない限り、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
はその名前:値ペアを追加します。同じ名前で存在する場合は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
はその値を更新します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
コマンド行では、文字 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
.B m 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
.B f 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
.I manifest 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
.I jarfile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
が出現するのと
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
同じ順序で使用します。次に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
% jar cmf myManifestFile myFile.jar *.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
manifest ファイルには、デフォルトのマニフェストに含まれていない、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
専用の名前:値属性ペアを追加できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
たとえば、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
ベンダー情報、バージョン情報、パッケージシーリング、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
または JAR にバンドルされたアプリケーションを実行するための属性を
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
追加できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
.B -m 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
オプションの使用例については、「Java Tutorial」
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
http://java.sun.com/docs/books/tutorial/jar/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
にある
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
.I JAR Files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
」コースを参照してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
e 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
実行可能 JAR ファイル内にバンドルされたスタンドアロンアプリケーションのアプリケーションエントリポイントとして、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
.I entrypoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
を設定します。このオプションを使用すると、マニフェストファイル内の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
.I Main\-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
属性値が作成または上書きされます。このオプションは、JAR ファイルの作成中または更新中に使用できます。このオプションを使えば、マニフェストファイルを編集または作成することなしに、アプリケーションのエントリポイントを指定できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
たとえば、次のコマンドは 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
.I Main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
を作成しますが、その際、マニフェストファイル内の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
.I Main\-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
属性値は 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
.I Main
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
に設定されます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
jar cfe Main.jar Main Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
次のコマンドを実行すると java ランタイムから直接このアプリケーションを起動できます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
java \-jar Main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
エントリポイントのクラス名が特定のパッケージ内に存在している場合、エントリポイントの区切り文字としてドット (「.」) またはスラッシュ (「/」) を使用できます。たとえば、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
.I Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
.I foo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
という名前のパッケージ内に存在している場合、次のようにしてエントリポイントを指定できます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
jar \-cfe Main.jar foo/Main foo/Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
または 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
jar \-cfe Main.jar foo.Main foo/Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
\f3注:\ \fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
.I \-m
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
オプションと 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
.I \-e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
オプションの両方を同時に指定する場合、指定されたマニフェストにも 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
.I Main\-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
属性が含まれていると、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
.I Main.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
の指定があいまいになってエラーが発生し、JAR の作成または更新処理が異常終了します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
.B \-C \ dir 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
.B jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
コマンドの実行中に一時的にディレクトリを変更します (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
.I cd " dir"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
このとき、後続の入力ファイル引数が処理されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
この動作は、UNIX の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
.I tar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
ユーティリティの 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
.I \-C 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
オプションと
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
同様の動作になります。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
たとえば、次のコマンドは、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
.I classes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
ディレクトリに移動し、そのディレクトリから 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
.I bar.classes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
に追加します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
jar uf foo.jar \-C classes bar.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
次のコマンドでは、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
.I classes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
ディレクトリに移動し、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
.I classes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
ディレクトリ内のすべてのファイルを
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
に追加します (jar ファイルには classes ディレクトリを作成しません)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
次に元のディレクトリに戻ってから、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
.I bin 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
ディレクトリに移動し、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
.I xyz.class 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
.I foo.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
に追加します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
jar uf foo.jar \-C classes . \-C bin xyz.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
.I classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
にファイル 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
.I bar1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
および 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
.I bar2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
がある場合、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
.I jar tf foo.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
を実行すると、jar ファイルの内容が次のように表示されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
.if t .RS 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
.if n .RS 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
.ft 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
META-INF/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
bar1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
bar2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
xyz.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
.ft 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
.if t .TP 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
.if n .TP 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
.B \-Joption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
.I option
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
を Java Runtime Environment に渡します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
ここで、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
.I option
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
は、Java アプリケーション起動プログラムのマニュアルページ
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
 (http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html#options) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
で説明されているオプションの 1 つです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
たとえば
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
.B \-J-Xms48m
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
は、最大メモリを 48M バイトに設定します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
.I \-J
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
が基本にする仮想マシンにオプションを渡すことは、共通の規約です。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
.SH "コマンド行引数ファイル"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
.B jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
コマンド行を短くまたは簡単にするために、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
.I jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
コマンドの引数 (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
.I \-J 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
オプションを除く) を含むファイルを 1 つ以上指定できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
これにより、任意の長さの 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
.B jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
コマンドを作成でき、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
オペレーティングシステムによるコマンド行の制限を
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
回避できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
引数ファイルには、オプションとファイル名を含めることができます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
引数ファイル内の引数は空白文字区切りまたは改行区切りにします。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
引数ファイル内のファイル名は、引数ファイルの位置に対してではなく、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
現在のディレクトリに対して相対的に指定します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
通常はオペレーティングシステムシェルによって展開されるワイルドカード (*) は
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
展開されません。ファイルを再帰的に解釈するための @ 文字は使用できません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
.I \-J 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
オプションは、起動プログラムに渡されるため、サポートされていません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
起動プログラムでは引数ファイルを使用できないためです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
.I jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
の実行時、各引数ファイルのパスおよび名前の先頭に @ 文字を付けて渡します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
.I jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
で先頭に文字 @ の付いた引数が出現するたびに、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
そのファイルの内容が引数リストに展開されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
次の例では、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
.I find
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
コマンドから出力されたファイル名を 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
.I classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
内に格納しています。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
% find . -name '*.class' -print > classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
その後、引数ファイル構文を使って
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
にリストを渡すと、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
.I Classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
.I jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
コマンドを実行できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
% jar cf my.jar @classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
引数ファイルはパスを指定できますが、相対パスが記述された引数ファイル内の
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
すべてのファイル名は、渡されたパスに対して相対的ではなく、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
現在の作業ディレクトリに相対的となります。次に例を示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
% jar @path1/classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
.SH "使用例"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
あるディレクトリ中のファイルをすべてアーカイブに追加する例を示します 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
(アーカイブがすでに存在する場合は、内容が上書きされます)。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
詳細を列挙すると (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
.I \-v
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
オプションを使用)、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
サイズや最終更新日など、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
アーカイブ内のファイルに関して詳しい情報が得られます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
.RS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
% ls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
1.au          Animator.class    monkey.jpg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
2.au          Wave.class        spacemusic.au
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
3.au          at_work.gif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
% jar cvf bundle.jar *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
added manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
adding: 1.au(in = 2324) (out= 67)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
adding: 2.au(in = 6970) (out= 90)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
adding: 3.au(in = 11616) (out= 108)(deflated 99%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
adding: Animator.class(in = 2266) (out= 66)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
adding: Wave.class(in = 3778) (out= 81)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
adding: at_work.gif(in = 6621) (out= 89)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
adding: monkey.jpg(in = 7667) (out= 91)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
adding: spacemusic.au(in = 3079) (out= 73)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
\f1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
イメージ、オーディオファイル、およびクラス用のサブディレクトリが
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
すでに存在する場合、単一の 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
.B jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
ファイルに結合できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
.RS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
% ls -F
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
audio/ classes/ images/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
% jar cvf bundle.jar audio classes images
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
added manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
adding: audio/(in = 0) (out= 0)(stored 0%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
adding: audio/1.au(in = 2324) (out= 67)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
adding: audio/2.au(in = 6970) (out= 90)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
adding: audio/3.au(in = 11616) (out= 108)(deflated 99%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
adding: audio/spacemusic.au(in = 3079) (out= 73)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
adding: classes/(in = 0) (out= 0)(stored 0%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
adding: classes/Animator.class(in = 2266) (out= 66)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
adding: classes/Wave.class(in = 3778) (out= 81)(deflated 97%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
adding: images/(in = 0) (out= 0)(stored 0%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
adding: images/monkey.jpg(in = 7667) (out= 91)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
adding: images/at_work.gif(in = 6621) (out= 89)(deflated 98%)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
% ls -F
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
audio/ bundle.jar classes/ images/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
\f1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
次の例では、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
.I t 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
オプションを指定して、jar ファイル中のエントリ名を表示します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
.RS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
% jar tf bundle.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
META-INF/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
audio/1.au
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
audio/2.au
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
audio/3.au
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
audio/spacemusic.au
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
classes/Animator.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
classes/Wave.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
images/monkey.jpg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
images/at_work.gif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
\f1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
クラスの読み込みを高速化するために jar ファイルにインデックスファイルを
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
追加する場合は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
.I i
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
オプションを使用してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
例:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
たとえば株取引アプリケーションの内部依存しているクラスを 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
.I main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
.I buy.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
および 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
.I sell.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
という 3 つの jar ファイル
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
に分割したとします。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
.I main.jar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
のマニフェストの 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
.I Class-Path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
属性に次のように指定した場合、 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
Class-Path: buy.jar sell.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
.I -i 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
オプションを使用すれば、アプリケーションのクラスの
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
読み込みを高速化できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
.RS 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
% jar i main.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
.I INDEX.LIST 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
ファイルが 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
.I META-INF 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
ディレクトリに追加されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
この結果、アプリケーションのクラスローダによってクラスまたは
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
リソースの検索が行われるときに、適切な jar ファイルがダウンロードされます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
.SH "関連項目"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
http://java.sun.com/javase/6/docs/technotes/guides/jar/jarGuide.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
.I The Jar Overview
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
.I The Jar File Specification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
.I The JarIndex Spec
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
http://java.sun.com/docs/books/tutorial/jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
.I Jar Tutorial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
(Java ソフトウェアの Web サイト内) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
http://java.sun.com/javase/6/docs/technotes/tools/share/pack200.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
.I pack200 Reference Page
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925