Java 创建WAR文件时出错

Java 创建WAR文件时出错,java,Java,错误消息说明了一切:您没有告诉jar哪些文件应该放在归档中。如果要添加当前目录下的所有内容,请使用 C:\Users\accer\Documents\NetBeansProjects\Scholarshipcrud>jar cf scholarship.war 'c'` flag requires manifest or input files to be specified! Usage: `jar {ctxui}[vfm0Me] [jar-file] [manifest-file]

错误消息说明了一切:您没有告诉jar哪些文件应该放在归档中。如果要添加当前目录下的所有内容,请使用

C:\Users\accer\Documents\NetBeansProjects\Scholarshipcrud>jar cf scholarship.war

'c'` flag requires manifest or input files to be specified!
Usage: `jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] fil
es ...
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
-e  specify application entry point for stand-alone application
    bundled into an executable jar file
-0  store only; use no ZIP compression
-M  do not create a manifest file for the entries
-i  generate index information for the specified jar files
-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, the archive file name and the entry point name are
specified in the same order as the 'm', 'f' and 'e' flags.

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/ .

错误消息说明了一切:您没有告诉jar哪些文件应该放在归档中。如果要添加当前目录下的所有内容,请使用

C:\Users\accer\Documents\NetBeansProjects\Scholarshipcrud>jar cf scholarship.war

'c'` flag requires manifest or input files to be specified!
Usage: `jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] fil
es ...
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
-e  specify application entry point for stand-alone application
    bundled into an executable jar file
-0  store only; use no ZIP compression
-M  do not create a manifest file for the entries
-i  generate index information for the specified jar files
-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, the archive file name and the entry point name are
specified in the same order as the 'm', 'f' and 'e' flags.

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/ .

根据目录中的文件结构,例如.package,然后键入:

jar cf scholarship.war *

现在,您应该能够将war放入任何容器中并激活web应用程序。

根据目录(例如.package)构建文件,然后键入:

jar cf scholarship.war *

现在,您应该能够将war放入任何容器中并激活web应用程序。

如果您正在使用netbeans,您可以通过以下路径执行此操作:


项目属性->构建->打包->编译后构建JAR

如果您正在使用netbeans,则可以使用以下路径:


项目属性->构建->打包->编译后构建JAR

如果要添加所有文件,请使用:

cd .package; jar cvf ../package.war *

jar-cvf scholarshion.war*如果要添加所有文件,请使用:

cd .package; jar cvf ../package.war *

jar-cvf scholarship.war**诀窍是阅读消息,它解释了你必须做什么。我重新格式化了这个问题,发现它都是控制台输出。如果问题中包含一些你自己的话,解释问题是什么以及你尝试了什么,我们更喜欢这样。诀窍是阅读信息,其中解释了你必须做什么。我重新格式化了这个问题,发现它都是控制台输出。如果问题中包含一些您自己的话,我们更喜欢它,解释问题是什么以及您尝试了什么。项目文件夹保存在documents/netbeans project/scholarship中。我知道war文件是在netbeans中创建的。但是,我想手动创建war文件。我在netbeans中使用jsp和servlet创建了该项目。项目文件夹保存在documents/netbeans project/scholarship中。我知道war文件是在netbeans中创建的。但是,我想手动创建war文件Hi friend,C:\Users\accer\Documents\NetBeansProjects\。我的所有项目都保存在netbeansprojects文件夹中。我不知道如何包装它。我需要你的帮助嗨,朋友,C:\Users\accer\Documents\NetBeansProjects\。我的所有项目都保存在netbeansprojects文件夹中。我不知道如何包装它。我需要您的帮助谢谢zao,但是我需要使用命令promptTanks zao手动创建,但是我需要使用命令promptTanks手动创建prompt@Gopalan当前位置我假设这是正确答案。如果是,请单击左侧的勾号。既然你没有回复Pankaj,我会否决你的问题,但一旦你回复我,我会很高兴地放弃投票(要么接受问题,要么解释这不是答案)。我得到了同样的问题,这是正确的解决方案,解决了我的问题。非常感谢。@Gopalan:我想这是正确的答案。如果是,请单击左侧的勾号。既然你没有回复Pankaj,我会否决你的问题,但一旦你回复我,我会很高兴地放弃投票(要么接受问题,要么解释这不是答案)。我得到了同样的问题,这是正确的解决方案,解决了我的问题。谢谢。