jar命令使用介绍
http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/jar.html
jar-The Java Archive Tool
jar combines multiple files into a single JAR archive file.
SYNOPSIS
- Create jar file
jar c[v0Mmfe] [manifest] [jarfile] [entrypoint] [-Cdir]inputfiles[-Joption]- Update jar file
jar u[v0Mmfe] [manifest] [jarfile] [entrypoint] [-Cdir]inputfiles[-Joption]- Extract jar file
jar x[vf] [jarfile] [inputfiles] [-Joption]- List table of contents of jar file
jar t[vf] [jarfile] [inputfiles] [-Joption]- Add index to jar file
jar ijarfile[-Joption]
where:
cuxtiv0Mmfe- Options that control the
jarcommand. - jarfile
- Jar file to be created (
c), updated (u), extracted (x), or have its table of contents viewed (t). The -f option and filename jarfile are a pair -- if either is present, they must both appear. Note that omittingfand jarfile accepts a "jar file" from standard input (for x and t) or sends the "jar file" to standard output (for c and u). - inputfiles
- Files or directories, separated by spaces, to be combined into jarfile (for c and u), or to be extracted (for x) or listed (for t) from jarfile. All directories are processed recursively. The files are compressed unless option 0 (zero) is used.
- manifest
- Pre-existing manifest file whose name
:value pairs are to be included in MANIFEST.MF in the jar file. The -m option and filename manifest are a pair -- if either is present, they must both appear. The letters m, f and e must appear in the same order that manifest, jarfile, entrypoint appear. - entrypoint
- The name of the class that set as the application entry point for stand-alone applications bundled into executable jar file. The -e option and entrypoint are a pair -- if either is present, they must both appear. The letters m, f and e must appear in the same order that manifest, jarfile, entrypoint appear.
-Cdir- Temporarily changes directories to dir while processing the following inputfiles argument. Multiple
-Cdir inputfiles sets are allowed. -Joption- Option to be passed into the Java runtime environment. (There must be no space between -J and option).
DESCRIPTION
The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly package java applets or applications into a single archive. When the components of an applet or application (files, images and sounds) are combined into a single archive, they can be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tarcommand. A jar archive can be used as a class path entry, whether or not it is compressed.
Typical usage to combine files into a jar file is:
% jar cf myFile.jar *.class
In this example, all the class files in the current directory are placed into the file named myFile.jar. The jar tool automatically generates a manifest file entry named META-INF/MANIFEST.MF. It is always the first entry in the jar file. The manifest file declares meta-information about the archive, and stores that data as name : value pairs. Refer to the JAR file specification for details explaining how the jar tool stores meta-information in the manifest file.
If a jar file should include name : value pairs contained in an existing manifest file, specify that file using the -m option:
% jar cmf myManifestFile myFile.jar *.class
An existing manifest file must end with a new line character. jar does not parse the last line of a manifest file if it does not end with a new line character.
Note: A jar command that specifies cfm on the command line instead of cmf (the order of the m and -f options are reversed), the jar command line must specify the name of the jar archive first, followed by the name of the manifest file:
% jar cfm myFile.jar myManifestFile *.class
The manifest is in a text format inspired by RFC822 ASCII format, so it is easy to view and process manifest-file contents.
To extract the files from a jar file, use x:
% jar xf myFile.jar
To extract individual files from a jar file, supply their filenames:
% jar xf myFile.jar foo bar
Beginning with version 1.3 of the JDK, the jar utility supports JarIndex, which allows application class loaders to load classes more efficiently from jar files. If an application or applet is bundled into multiple jar files, only the necessary jar files will be downloaded and opened to load classes. This performance optimization is enabled by running jar with the -ioption. It will generate package location information for the specified main jar file and all the jar files it depends on, which need to be specified in the Class-Path attribute of the main jar file's manifest.
% jar i main.jar
In this example, an INDEX.LIST file is inserted into the META-INF directory of main.jar.
The application class loader uses the information stored in this file for efficient class loading. For details about how location information is stored in the index file, refer to the JarIndex specification.
To copy directories, first compress files in dir1 to stdout, then extract from stdin to dir2 (omitting the -f option from both jar commands):
% (cd dir1; jar c .) | (cd dir2; jar x)
To review command samples which use jar to opeate on jar files and jar file manifests, see Examples, below. Also refer to the jar trail of the Java Tutorial.
OPTIONS
- c
- Creates a new archive file named jarfile (if
fis specified) or to standard output (iffand jarfile are omitted). Add to it the files and directories specified by inputfiles. - u
- Updates an existing file jarfile (when
fis specified) by adding to it files and directories specified by inputfiles. For example:jar uf foo.jar foo.class
would add the file foo.class to the existing jar file foo.jar. The -u option can also update the manifest entry, as given by this example:
jar umf manifest foo.jar
updates the foo.jar manifest with the name : value pairs in manifest.
- x
- Extracts files and directories from jarfile (if
fis specified) or standard input (iffand jarfile are omitted). If inputfiles is specified, only those specified files and directories are extracted. Otherwise, all files and directories are extracted. The time and date of the extracted files are those given in the archive. - t
- Lists the table of contents from jarfile (if
fis specified) or standard input (iffand jarfile are omitted). If inputfiles is specified, only those specified files and directories are listed. Otherwise, all files and directories are listed. - i
- Generate index information for the specified jarfile and its dependent jar files. For example:
jar i foo.jar
would generate an INDEX.LIST file in foo.jar which contains location information for each package in foo.jar and all the jar files specified in the Class-Path attribute of foo.jar. See the index example.
- f
- Specifies the file jarfile to be created (
c), updated (u), extracted (x), indexed (i), or viewed (t). The -f option and filename jarfile are a pair -- if present, they must both appear. Omittingfand jarfile accepts a jar file name fromstdin(for x and t) or sends jar file tostdout(for c and u). - v
- Generates verbose output to standard output. Examples shown below.
- 0
- (zero) Store without using ZIP compression.
- M
- Do not create a manifest file entry (for c and u), or delete a manifest file entry if one exists (for u).
- m
- Includes name : value attribute pairs from the specified manifest file manifest in the file at META-INF/MANIFEST.MF.
jaradds a name : value pair unless an entry already exists with the same name, in which casejarupdates its value.On the command line, the letters m and f must appear in the same order that manifest and jarfile appear. Example use:
jar cmf myManifestFile myFile.jar *.class
You can add special-purpose name : value attribute pairs to the manifest that aren't contained in the default manifest. For example, you can add attributes specifying vendor information, version information, package sealing, or to make JAR-bundled applications executable. See the Packaging Programs in JAR Files lesson in the Java Tutorial for examples of using the -m option.
- e
- Sets entrypoint as the application entry point for stand-alone applications bundled into executable jar file. The use of this option creates or overrides the Main-Class attribute value in the manifest file. This option can be used during creation of jar file or while updating the jar file. This option specifies the application entry point without editing or creating the manifest file.
For example, this command creates
Main.jarwhere the Main-Class attribute value in the manifest is set toMain:jar cfe Main.jar Main Main.class
The java runtime can directly invoke this application by running the following command:
java -jar Main.jar
If the entrypoint class name is in a package it may use either a dot (".") or slash ("/") character as the delimiter. For example, if
Main.classis in a package calledfoothe entry point can be specified in the following ways:jar -cfe Main.jar foo/Main foo/Main.class
or
jar -cfe Main.jar foo.Main foo/Main.class
Note: specifying both
-mand -e options together when the given manifest also contains the Main-Class attribute results in an ambigousMain.classspecification, leading to an error and the jar creation or update operation is aborted. - -C dir
- Temporarily changes directories (
cddir) during execution of the jar command while processing the following inputfiles argument. Its operation is intended to be similar to the -C option of the UNIX tar utility.For example, this command changes to the classes directory and adds the bar.class from that directory to foo.jar:
jar uf foo.jar -C classes bar.class
This command changes to the classes directory and adds to foo.jar all files within the classes directory (without creating a classes directory in the jar file), then changes back to the original directory before changing to the bin directory to add xyz.class tofoo.jar.
jar uf foo.jar -C classes . -C bin xyz.class
If
classesholds filesbar1andbar2, then here's what the jar file will contain usingjar tf foo.jar:META-INF/
META-INF/MANIFEST.MF
bar1
bar2
xyz.class - -Joption
- Pass option to the Java runtime environment, where option is one of the options described on the reference page for the java application launcher. For example,
-J-Xmx48Msets the maximum memory to 48 megabytes. It is a common convention for -J to pass options to the underlying runtime environment.
COMMAND LINE ARGUMENT FILES
To shorten or simplify the jar command line, you can specify one or more files that themselves contain arguments to the jar command (except -J options). This enables you to create jar commands of any length, overcoming command line limits imposed by the operating system.
An argument file can include options and filenames. The arguments within a file can be space-separated or newline-separated. Filenames within an argument file are relative to the current directory, not relative to the location of the argument file. Wildcards (*) that might otherwise be expanded by the operating system shell are not expanded. Use of the @ character to recursively interpret files is not supported. The -J options are not supported because they are passed to the launcher, which does not support argument files.
When executing jar, pass in the path and name of each argument file with the @ leading character. When jar encounters an argument beginning with the character @, it expands the contents of that file into the argument list.
The example below, classes.list holds the names of files output by a find command:
% find . -name '*.class' -print > classes.list
You can then execute the jar command on Classes.list by passing it to jar using argfile syntax:
% jar cf my.jar @classes.list
An argument file can specify a path, but any filenames inside the argument file that have relative paths are relative to the current working directory, not to the path passed in. Here is an example:
% jar @path1/classes.list
EXAMPLES
To add all the files in a particular directory to an archive (overwriting contents if the archive already exists). Enumerating verbosely (with the -v option) will tell you more information about the files in the archive, such as their size and last modified date.
% ls
1.au Animator.class monkey.jpg
2.au Wave.class spacemusic.au
3.au at_work.gif % jar cvf bundle.jar *
added manifest
adding: 1.au(in = 2324) (out= 67)(deflated 97%)
adding: 2.au(in = 6970) (out= 90)(deflated 98%)
adding: 3.au(in = 11616) (out= 108)(deflated 99%)
adding: Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: at_work.gif(in = 6621) (out= 89)(deflated 98%)
adding: monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: spacemusic.au(in = 3079) (out= 73)(deflated 97%)
If you already have separate subdirectories for images, audio files and classes, you can combine them into a single jar file:
% ls -F
audio/ classes/ images/ % jar cvf bundle.jar audio classes images
added manifest
adding: audio/(in = 0) (out= 0)(stored 0%)
adding: audio/1.au(in = 2324) (out= 67)(deflated 97%)
adding: audio/2.au(in = 6970) (out= 90)(deflated 98%)
adding: audio/3.au(in = 11616) (out= 108)(deflated 99%)
adding: audio/spacemusic.au(in = 3079) (out= 73)(deflated 97%)
adding: classes/(in = 0) (out= 0)(stored 0%)
adding: classes/Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: classes/Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: images/(in = 0) (out= 0)(stored 0%)
adding: images/monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: images/at_work.gif(in = 6621) (out= 89)(deflated 98%) % ls -F
audio/ bundle.jar classes/ images/
To see the entry names in the jarfile, use the t option:
% jar tf bundle.jar
META-INF/
META-INF/MANIFEST.MF
audio/1.au
audio/2.au
audio/3.au
audio/spacemusic.au
classes/Animator.class
classes/Wave.class
images/monkey.jpg
images/at_work.gif
To add an index file to the jar file for speeding up class loading, use the i option.
Example:
If you split the inter-dependent classes for a stock trade application into three jar files: main.jar, buy.jar, and sell.jar.
If you specify the Class-path attribute in the main.jar manifest as:
Class-Path: buy.jar sell.jar
then you can use the -i option to speed up the class loading time for your application:
% jar i main.jar
An INDEX.LIST file is inserted to the META-INF directory. This enables the application class loader to download the specified jar files when it is searching for classes or resources.
SEE ALSO
jar-The Java Archive Tool
jar combines multiple files into a single JAR archive file.
SYNOPSIS
- Create jar file
jar c[v0Mmfe] [manifest] [jarfile] [entrypoint] [-Cdir]inputfiles[-Joption]- Update jar file
jar u[v0Mmfe] [manifest] [jarfile] [entrypoint] [-Cdir]inputfiles[-Joption]- Extract jar file
jar x[vf] [jarfile] [inputfiles] [-Joption]- List table of contents of jar file
jar t[vf] [jarfile] [inputfiles] [-Joption]- Add index to jar file
jar ijarfile[-Joption]
where:
cuxtiv0Mmfe- Options that control the
jarcommand. - jarfile
- Jar file to be created (
c), updated (u), extracted (x), or have its table of contents viewed (t). The -f option and filename jarfile are a pair -- if either is present, they must both appear. Note that omittingfand jarfile accepts a "jar file" from standard input (for x and t) or sends the "jar file" to standard output (for c and u). - inputfiles
- Files or directories, separated by spaces, to be combined into jarfile (for c and u), or to be extracted (for x) or listed (for t) from jarfile. All directories are processed recursively. The files are compressed unless option 0 (zero) is used.
- manifest
- Pre-existing manifest file whose name
:value pairs are to be included in MANIFEST.MF in the jar file. The -m option and filename manifest are a pair -- if either is present, they must both appear. The letters m, f and e must appear in the same order that manifest, jarfile, entrypoint appear. - entrypoint
- The name of the class that set as the application entry point for stand-alone applications bundled into executable jar file. The -e option and entrypoint are a pair -- if either is present, they must both appear. The letters m, f and e must appear in the same order that manifest, jarfile, entrypoint appear.
-Cdir- Temporarily changes directories to dir while processing the following inputfiles argument. Multiple
-Cdir inputfiles sets are allowed. -Joption- Option to be passed into the Java runtime environment. (There must be no space between -J and option).
DESCRIPTION
The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly package java applets or applications into a single archive. When the components of an applet or application (files, images and sounds) are combined into a single archive, they can be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tarcommand. A jar archive can be used as a class path entry, whether or not it is compressed.
Typical usage to combine files into a jar file is:
% jar cf myFile.jar *.class
In this example, all the class files in the current directory are placed into the file named myFile.jar. The jar tool automatically generates a manifest file entry named META-INF/MANIFEST.MF. It is always the first entry in the jar file. The manifest file declares meta-information about the archive, and stores that data as name : value pairs. Refer to the JAR file specification for details explaining how the jar tool stores meta-information in the manifest file.
If a jar file should include name : value pairs contained in an existing manifest file, specify that file using the -m option:
% jar cmf myManifestFile myFile.jar *.class
An existing manifest file must end with a new line character. jar does not parse the last line of a manifest file if it does not end with a new line character.
Note: A jar command that specifies cfm on the command line instead of cmf (the order of the m and -f options are reversed), the jar command line must specify the name of the jar archive first, followed by the name of the manifest file:
% jar cfm myFile.jar myManifestFile *.class
The manifest is in a text format inspired by RFC822 ASCII format, so it is easy to view and process manifest-file contents.
To extract the files from a jar file, use x:
% jar xf myFile.jar
To extract individual files from a jar file, supply their filenames:
% jar xf myFile.jar foo bar
Beginning with version 1.3 of the JDK, the jar utility supports JarIndex, which allows application class loaders to load classes more efficiently from jar files. If an application or applet is bundled into multiple jar files, only the necessary jar files will be downloaded and opened to load classes. This performance optimization is enabled by running jar with the -ioption. It will generate package location information for the specified main jar file and all the jar files it depends on, which need to be specified in the Class-Path attribute of the main jar file's manifest.
% jar i main.jar
In this example, an INDEX.LIST file is inserted into the META-INF directory of main.jar.
The application class loader uses the information stored in this file for efficient class loading. For details about how location information is stored in the index file, refer to the JarIndex specification.
To copy directories, first compress files in dir1 to stdout, then extract from stdin to dir2 (omitting the -f option from both jar commands):
% (cd dir1; jar c .) | (cd dir2; jar x)
To review command samples which use jar to opeate on jar files and jar file manifests, see Examples, below. Also refer to the jar trail of the Java Tutorial.
OPTIONS
- c
- Creates a new archive file named jarfile (if
fis specified) or to standard output (iffand jarfile are omitted). Add to it the files and directories specified by inputfiles. - u
- Updates an existing file jarfile (when
fis specified) by adding to it files and directories specified by inputfiles. For example:jar uf foo.jar foo.class
would add the file foo.class to the existing jar file foo.jar. The -u option can also update the manifest entry, as given by this example:
jar umf manifest foo.jar
updates the foo.jar manifest with the name : value pairs in manifest.
- x
- Extracts files and directories from jarfile (if
fis specified) or standard input (iffand jarfile are omitted). If inputfiles is specified, only those specified files and directories are extracted. Otherwise, all files and directories are extracted. The time and date of the extracted files are those given in the archive. - t
- Lists the table of contents from jarfile (if
fis specified) or standard input (iffand jarfile are omitted). If inputfiles is specified, only those specified files and directories are listed. Otherwise, all files and directories are listed. - i
- Generate index information for the specified jarfile and its dependent jar files. For example:
jar i foo.jar
would generate an INDEX.LIST file in foo.jar which contains location information for each package in foo.jar and all the jar files specified in the Class-Path attribute of foo.jar. See the index example.
- f
- Specifies the file jarfile to be created (
c), updated (u), extracted (x), indexed (i), or viewed (t). The -f option and filename jarfile are a pair -- if present, they must both appear. Omittingfand jarfile accepts a jar file name fromstdin(for x and t) or sends jar file tostdout(for c and u). - v
- Generates verbose output to standard output. Examples shown below.
- 0
- (zero) Store without using ZIP compression.
- M
- Do not create a manifest file entry (for c and u), or delete a manifest file entry if one exists (for u).
- m
- Includes name : value attribute pairs from the specified manifest file manifest in the file at META-INF/MANIFEST.MF.
jaradds a name : value pair unless an entry already exists with the same name, in which casejarupdates its value.On the command line, the letters m and f must appear in the same order that manifest and jarfile appear. Example use:
jar cmf myManifestFile myFile.jar *.class
You can add special-purpose name : value attribute pairs to the manifest that aren't contained in the default manifest. For example, you can add attributes specifying vendor information, version information, package sealing, or to make JAR-bundled applications executable. See the Packaging Programs in JAR Files lesson in the Java Tutorial for examples of using the -m option.
- e
- Sets entrypoint as the application entry point for stand-alone applications bundled into executable jar file. The use of this option creates or overrides the Main-Class attribute value in the manifest file. This option can be used during creation of jar file or while updating the jar file. This option specifies the application entry point without editing or creating the manifest file.
For example, this command creates
Main.jarwhere the Main-Class attribute value in the manifest is set toMain:jar cfe Main.jar Main Main.class
The java runtime can directly invoke this application by running the following command:
java -jar Main.jar
If the entrypoint class name is in a package it may use either a dot (".") or slash ("/") character as the delimiter. For example, if
Main.classis in a package calledfoothe entry point can be specified in the following ways:jar -cfe Main.jar foo/Main foo/Main.class
or
jar -cfe Main.jar foo.Main foo/Main.class
Note: specifying both
-mand -e options together when the given manifest also contains the Main-Class attribute results in an ambigousMain.classspecification, leading to an error and the jar creation or update operation is aborted. - -C dir
- Temporarily changes directories (
cddir) during execution of the jar command while processing the following inputfiles argument. Its operation is intended to be similar to the -C option of the UNIX tar utility.For example, this command changes to the classes directory and adds the bar.class from that directory to foo.jar:
jar uf foo.jar -C classes bar.class
This command changes to the classes directory and adds to foo.jar all files within the classes directory (without creating a classes directory in the jar file), then changes back to the original directory before changing to the bin directory to add xyz.class tofoo.jar.
jar uf foo.jar -C classes . -C bin xyz.class
If
classesholds filesbar1andbar2, then here's what the jar file will contain usingjar tf foo.jar:META-INF/
META-INF/MANIFEST.MF
bar1
bar2
xyz.class - -Joption
- Pass option to the Java runtime environment, where option is one of the options described on the reference page for the java application launcher. For example,
-J-Xmx48Msets the maximum memory to 48 megabytes. It is a common convention for -J to pass options to the underlying runtime environment.
COMMAND LINE ARGUMENT FILES
To shorten or simplify the jar command line, you can specify one or more files that themselves contain arguments to the jar command (except -J options). This enables you to create jar commands of any length, overcoming command line limits imposed by the operating system.
An argument file can include options and filenames. The arguments within a file can be space-separated or newline-separated. Filenames within an argument file are relative to the current directory, not relative to the location of the argument file. Wildcards (*) that might otherwise be expanded by the operating system shell are not expanded. Use of the @ character to recursively interpret files is not supported. The -J options are not supported because they are passed to the launcher, which does not support argument files.
When executing jar, pass in the path and name of each argument file with the @ leading character. When jar encounters an argument beginning with the character @, it expands the contents of that file into the argument list.
The example below, classes.list holds the names of files output by a find command:
% find . -name '*.class' -print > classes.list
You can then execute the jar command on Classes.list by passing it to jar using argfile syntax:
% jar cf my.jar @classes.list
An argument file can specify a path, but any filenames inside the argument file that have relative paths are relative to the current working directory, not to the path passed in. Here is an example:
% jar @path1/classes.list
EXAMPLES
To add all the files in a particular directory to an archive (overwriting contents if the archive already exists). Enumerating verbosely (with the -v option) will tell you more information about the files in the archive, such as their size and last modified date.
% ls
1.au Animator.class monkey.jpg
2.au Wave.class spacemusic.au
3.au at_work.gif % jar cvf bundle.jar *
added manifest
adding: 1.au(in = 2324) (out= 67)(deflated 97%)
adding: 2.au(in = 6970) (out= 90)(deflated 98%)
adding: 3.au(in = 11616) (out= 108)(deflated 99%)
adding: Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: at_work.gif(in = 6621) (out= 89)(deflated 98%)
adding: monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: spacemusic.au(in = 3079) (out= 73)(deflated 97%)
If you already have separate subdirectories for images, audio files and classes, you can combine them into a single jar file:
% ls -F
audio/ classes/ images/ % jar cvf bundle.jar audio classes images
added manifest
adding: audio/(in = 0) (out= 0)(stored 0%)
adding: audio/1.au(in = 2324) (out= 67)(deflated 97%)
adding: audio/2.au(in = 6970) (out= 90)(deflated 98%)
adding: audio/3.au(in = 11616) (out= 108)(deflated 99%)
adding: audio/spacemusic.au(in = 3079) (out= 73)(deflated 97%)
adding: classes/(in = 0) (out= 0)(stored 0%)
adding: classes/Animator.class(in = 2266) (out= 66)(deflated 97%)
adding: classes/Wave.class(in = 3778) (out= 81)(deflated 97%)
adding: images/(in = 0) (out= 0)(stored 0%)
adding: images/monkey.jpg(in = 7667) (out= 91)(deflated 98%)
adding: images/at_work.gif(in = 6621) (out= 89)(deflated 98%) % ls -F
audio/ bundle.jar classes/ images/
To see the entry names in the jarfile, use the t option:
% jar tf bundle.jar
META-INF/
META-INF/MANIFEST.MF
audio/1.au
audio/2.au
audio/3.au
audio/spacemusic.au
classes/Animator.class
classes/Wave.class
images/monkey.jpg
images/at_work.gif
To add an index file to the jar file for speeding up class loading, use the i option.
Example:
If you split the inter-dependent classes for a stock trade application into three jar files: main.jar, buy.jar, and sell.jar.
If you specify the Class-path attribute in the main.jar manifest as:
Class-Path: buy.jar sell.jar
then you can use the -i option to speed up the class loading time for your application:
% jar i main.jar
An INDEX.LIST file is inserted to the META-INF directory. This enables the application class loader to download the specified jar files when it is searching for classes or resources.
SEE ALSO
jar命令使用介绍的更多相关文章
- 如何用jar命令对java工程进行打包
如何用jar命令对java工程进行打包 有时候为了更方便快捷的部署和执行Java程序,要把java应用程序打包成一个jar包.而这个基础的操作有时候也很麻烦,为了方便java程序员们能够方便的打包ja ...
- JAVA_SE基础——58.如何用jar命令对java工程进行打包
有时候为了更方便快捷的部署和执行Java程序,要把java应用程序打包成一个jar包.而这个基础的操作有时候也很麻烦,为了方便java程序员们能够方便的打包java应用程序,下面对jar命令进行介绍, ...
- 利用jar命令打包和解压
常常在网上看到有人询问:如何把 java 程序编译成 .exe 文件.通常回答只有两种,一种是制作一个可执行的 JAR 文件包,然后就可以像.chm 文档一样双击运行了:而另一种是使用 JET 来进行 ...
- [转] - JAR文件包及jar命令详解 ( MANIFEST.MF的用法 )
常常在网上看到有人询问:如何把 java 程序编译成 .exe 文件.通常回答只有两种,一种是制作一个可执行的 JAR 文件包,然后就可以像. chm 文档一样双击运行了:而另一种是使用 JET 来进 ...
- java之jar命令详解
1. JAR 文件包 JAR 文件就是 Java Archive File,顾名思意,它的应用是与 Java 息息相关的,是 Java 的一种文档格式.JAR 文件非常类似 ZIP 文件——准确的说, ...
- Java中jar命令详解
做项目的时候我们肯定接触过很多jar包,那么jar包是什么呢?笔者了解到jar是java archive file 的简写.从名字就可以知道,它的应用与Java息息相关.下面就详细介绍如何自己生成ja ...
- jar 命令详解
jar 是随 JDK 安装的,在 JDK 安装目录下的 bin 目录中,Windows 下文件名为 jar.exe,Linux 下文件名为 jar.它的运行需要用到 JDK 安装目录下 lib 目录中 ...
- JAR命令使用
jar 命令详解 jar 是随 JDK 安装的,在 JDK 安装目录下的 bin 目录中,Windows 下文件名为 jar.exe,Linux 下文件名为 jar.它的运行需要用到 JDK 安装目录 ...
- jar命令简单使用
以windows10操作系统,JDK1.8为例: 打包主要是针对class文件以及依赖的jar包. 1.编写MANIFEST.MF文件(详细可以上网查一下MANIFEST.MF文件规则.) 此文件主要 ...
随机推荐
- win7运行nodejs,返回IPV6:::ffff:127.0.0.1
问题: 在win7上使用telnet连接node生成的服务器,在获取ip的过程中出现的问题. win7默认开启IPV6,所以获取的IP地址带有::ffff:前缀. 如果程序中使用到了IP地址,有可能会 ...
- Android IntentService 的使用
1.service 执行耗时任务的步骤 2.IntentService (1)介绍 (2)使用方法 (3)优点 (4)在AndroidManifest.xml文件中添加service设置 <se ...
- DP小小结
入门题 : [Luogu1441]砝码称重 , [NOIP2015]子串 [AHOI2009]中国象棋 , 详见代码 [HNOI2007]梦幻岛宝珠 , 详见代码 [NOIP2012]开车旅行 , 没 ...
- hdu1509 优先队列
Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...
- Xtts v4 xttdriver.pl & xtt.properties
Perl脚本xttdriver.pl选项的描述 下表描述了主要支持脚本xttdriver.pl的可用选项. 级备份.这些备份将写入xtt.properties变量"backupformat ...
- MySQL数据库插入中文时出现Incorrect string value: '\xE6\x97\xB7\xE5\x85\xA8' for column 'sz_name' at row 1
今天在开发时候出现了这个问题 Incorrect string value: '\xE6\x97\xB7\xE5\x85\xA8' for column 'sz_name' at row 1 场景,往 ...
- (转)企业Shell实战-MySQL分库分表备份脚本
本文来自http://www.xuliangwei.com/xubusi/252.html 免费视频讲解见 http://edu.51cto.com/course/course_id-5064.htm ...
- 安装Drupal
我在虚拟机里面安装了Ubuntu Server 14.参考https://www.digitalocean.com/community/tutorials/how-to-install-drupal- ...
- 05-ognl基本语法
1 基本取值 @Test //1基础语法演示-基本取值 //取出root中的属性值 public void fun2() throws Exception{ //1 准备OGNLcontext Ogn ...
- JQuery实现表格的全选和反选,以及分页勾选保存(laypage插件分页的使用)
需求: 1.全选与取消全选 2.单个勾选,点击表格单元格中checkbox勾选,也可以在点击行勾选,便与用户操作 3.分页勾选保存 4.固定表头 功能一: 说明:操作全选按钮的同时,遍历每一个tr中的 ...