服务器文件的压缩和打包 若要把服务器文件压缩并打包到一个 JAR 文件中,则应在一个命令行上输入 以下命令。该命令在文件所在的目录下运行。如果要从其它目录下运行该命令, 就必须指明全路径名。 jar cf server.jar RemoteServer.class RemoteServer_skel.class RemoteServer_stub.class Send.class DataOrder.class java.policyjar 是指 jar 命令。如果键入的 jar 不带选项,屏幕上将出现以下的帮助屏。在帮助屏上,您会发现 jar 命令的 cf 选项表示创建一个名为 server.jar 的 新 JAR 文件,并将紧随其后的一系列文件放入新文件中。这个新的 JAR 文件将被 存放到当前目录下。 kq6py% jar Usage: jar {ctxu}[vfm0M] [jar-file] [manifest-file] [-C dir] files ... Options: -c create new archive -t list table of contents for archive -x extract named (or all) files from archive -u update existing archive -v generate verbose output on standard output -f specify archive file name -m include manifest information from specified manifest file -0 store only; use no ZIP compression -M Do not create a manifest file for the entries -C change to the specified directory and include the following file If any file is a directory then it is processed recursively. The manifest file name and the archive file name needs to be specified in the same order the 'm' and 'f' flags are specified.Example 1: to archive two class files into an archive called classes.jar: jar cvf classes.jar Foo.class Bar.class Example 2: use an existing manifest file 'mymanifest' and archive all the files in the foo/ directory into 'classes.jar': jar cvfm classes.jar mymanifest -C foo/ .使用服务器文件时,您需要做的就是把 server.jar 文件移动到执 行这些文件的一个共享目录下。 服务器文件的解压缩和拆包 把 JAR 文件移动到最终位置后,就需要解压缩和拆包被压缩和打包的文件, 这样才能启动服务器。以下命令所完成的操作是从 server.jar 文 件(f)中提取(x)出所有的文件。 jar xf server.jar水果订单文件组 水果订单文件组(列举如下)由 applet 类、网页、译文文件和policy文件组 成。因为它们是在网络使用的,所以需要放置在可被网络服务器访问的目录下。 使用这些文件最简单的方法是把它们全部捆绑到一个 JAR 文件中并把它们复制到 各自的位置上。 RMIEnglishApp.class RMIFrenchApp.class RMIGermanApp.class index.html (top-level web page where user chooses language) rmiEapp.html (second-level web page for English) rmiFapp.html (second-level web page for French) rmiGapp.html (second-level web page for German) MessagesBundle_de_DE.properties MessagesBundle_en_US.properties MessagesBundle_fr_FR.properties java.policy 文件的压缩和打包 jar cf applet.jar RMIEnglishApp.class RMIFrenchApp.class RMIGermanApp.class index.html rmiEapp.html rmiFapp.html rmiGapp.html MessagesBundle_de_DE.properties MessagesBundle_en_US.properties MessagesBundle_fr_FR.properties java.policy
用法:jar {ctxu}[vfm0Mi] [jar-文件] [manifest-文件] [-C 目录] 文件名 ...
选项:
-c 创建新的存档
-t 列出存档内容的列表
-x 展开存档中的命名的(或所有的〕文件
-u 更新已存在的存档
-v 生成详细输出到标准输出上
-f 指定存档文件名
-m 包含来自标明文件的标明信息
-0 只存储方式;未用ZIP压缩格式
-M 不产生所有项的清单(manifest〕文件
-i 为指定的jar文件产生索引信息
-C 改变到指定的目录,并且包含下列文件:
如果一个文件名是一个目录,它将被递归处理。
清单(manifest〕文件名和存档文件名都需要被指定,按'm' 和 'f'标志指定的相同顺序。示例1:将两个class文件存档到一个名为 'classes.jar' 的存档文件中:
jar cvf classes.jar Foo.class Bar.class
示例2:用一个存在的清单(manifest)文件 'mymanifest' 将 foo/ 目录下的所有
文件存档到一个名为 'classes.jar' 的存档文件中:
jar cvfm classes.jar mymanifest -C foo/ .
若要把服务器文件压缩并打包到一个 JAR 文件中,则应在一个命令行上输入 以下命令。该命令在文件所在的目录下运行。如果要从其它目录下运行该命令, 就必须指明全路径名。 jar cf server.jar
RemoteServer.class
RemoteServer_skel.class
RemoteServer_stub.class
Send.class
DataOrder.class
java.policyjar 是指 jar 命令。如果键入的 jar 不带选项,屏幕上将出现以下的帮助屏。在帮助屏上,您会发现 jar 命令的 cf 选项表示创建一个名为 server.jar 的 新 JAR 文件,并将紧随其后的一系列文件放入新文件中。这个新的 JAR 文件将被 存放到当前目录下。
kq6py% jar
Usage: jar {ctxu}[vfm0M] [jar-file] [manifest-file]
[-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified
manifest file
-0 store only; use no ZIP compression
-M Do not create a manifest file for the entries
-C change to the specified directory and
include the following file
If any file is a directory then it is processed
recursively.
The manifest file name and the archive file name
needs to be specified in the same order the
'm' and 'f' flags are specified.Example 1: to archive two class files into an
archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest'
and archive all the files in the foo/ directory
into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .使用服务器文件时,您需要做的就是把 server.jar 文件移动到执 行这些文件的一个共享目录下。
服务器文件的解压缩和拆包
把 JAR 文件移动到最终位置后,就需要解压缩和拆包被压缩和打包的文件, 这样才能启动服务器。以下命令所完成的操作是从 server.jar 文 件(f)中提取(x)出所有的文件。 jar xf server.jar水果订单文件组
水果订单文件组(列举如下)由 applet 类、网页、译文文件和policy文件组 成。因为它们是在网络使用的,所以需要放置在可被网络服务器访问的目录下。 使用这些文件最简单的方法是把它们全部捆绑到一个 JAR 文件中并把它们复制到 各自的位置上。 RMIEnglishApp.class
RMIFrenchApp.class
RMIGermanApp.class
index.html (top-level web page where user chooses language)
rmiEapp.html (second-level web page for English)
rmiFapp.html (second-level web page for French)
rmiGapp.html (second-level web page for German)
MessagesBundle_de_DE.properties
MessagesBundle_en_US.properties
MessagesBundle_fr_FR.properties
java.policy
文件的压缩和打包 jar cf applet.jar
RMIEnglishApp.class
RMIFrenchApp.class
RMIGermanApp.class
index.html
rmiEapp.html
rmiFapp.html
rmiGapp.html
MessagesBundle_de_DE.properties
MessagesBundle_en_US.properties
MessagesBundle_fr_FR.properties
java.policy