java -xvf test.jar 不工作

java -xvf test.jar not working

我试图提取 test.jar 命令执行成功但没有输出。

user@host:home/test->ll
drwxr-xr-x 107 user abc  6040 Apr  4 09:55 ..
drwxr-xr-x   2 user abc    26 Apr  4 10:06 .
-rw-r--r--   1 user abc 51241 Apr  4 10:06 test.jar
user@host:home/test->jar -xvf test.jar
user@host:home/test->ll
total 262
drwxr-xr-x 107 user abc  6040 Apr  4 09:55 ..
drwxr-xr-x   2 user abc    26 Apr  4 10:06 .
-rw-r--r--   1 user abc 51241 Apr  4 10:06 test.jar

请帮我解决这个问题

实际要求: 需要提取和访问 jar 文件中的资源。

根据 Oracle Java 教程: https://docs.oracle.com/javase/tutorial/deployment/jar/unpack.html 你应该解压它:

jar xfv test.jar

没有'-'号。

x option indicates that you want to extract files from the JAR archive.

f options indicates that the JAR file from which files are to be extracted is specified on the command line, rather than through stdin.

v is verbose

也尝试使用此命令 unzip test.jar 和以下命令可帮助您查看某些文件而无需提取所有文件。

unzip -q -c test.jar META-INF/MANIFEST.MF