Linux: .jar ファイルの内容を確認する最も便利な方法は何ですか

Linux: .jar ファイルの内容を確認する最も便利な方法は何ですか

unzip/untar コマンドを使用せずに .jar ファイルの内容を確認する最も便利な方法は何ですか? 私がやりたいのは、cd通常のフォルダーのようにコマンドを使用して内部を参照し、内容やクラスのサイズを確認することです'ls -la'

MC即座に実行できます。使いやすい代替手段はありますか?

答え1

jarファイルの内容を一覧表示するには、Java SDKに付属のjarツールを使用します。http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html

$ jar tvf jarfile.jar

答え2

vim を使用して、jar ファイルの内容を展開せずに表示および編集します。

次のように vim で jar を開きます。

vim rabbitmq-client.jar

ファイルのリストが表示されます:

1 " zip.vim version v22
2 " Browsing zipfile /var/www/sandbox/eric/rabbitmq-client.jar
3 " Select a file with cursor and press ENTER
4
5 META-INF/
6 META-INF/MANIFEST.MF
7 com/
8 com/rabbitmq/
9 com/rabbitmq/client/
10 com/rabbitmq/client/impl/
11 com/rabbitmq/client/impl/recovery/
12 com/rabbitmq/tools/
13 com/rabbitmq/tools/json/
14 com/rabbitmq/tools/jsonrpc/
15 com/rabbitmq/utility/

カーソルを の上に置いて を押しますMETA-INF/MANIFEST.MFEnter次のように表示されます。

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_31-b31 (Sun Microsystems Inc.)
Export-Package: com.rabbitmq.client;version="3.3.5";uses:="com.rabbitm
 q.client.impl,com.rabbitmq.utility,javax.net,javax.net.ssl,javax.secu
 rity.auth.callback,javax.security.sasl",com.rabbitmq.client.impl;vers
 ion="3.3.5";uses:="com.rabbitmq.client,com.rabbitmq.utility,javax.net
 ",com.rabbitmq.client.impl.recovery;version="3.3.5";uses:="com.rabbit
 mq.client,com.rabbitmq.client.impl",com.rabbitmq.tools;version="3.3.5
 ";uses:="com.rabbitmq.utility",com.rabbitmq.tools.json;version="3.3.5
 ",com.rabbitmq.tools.jsonrpc;version="3.3.5";uses:="com.rabbitmq.clie
 nt",com.rabbitmq.utility;version="3.3.5"
Bundle-Vendor: SpringSource
Bundle-Version: 3.3.5
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: RabbitMQ Java AMQP client library
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.rabbitmq.client
Import-Package: javax.net;version="0",javax.net.ssl;version="0",javax.
 security.auth.callback;version="0",javax.security.sasl;version="0"

Name: rabbitmq-client
Specification-Title: AMQP
Specification-Version: 0.9.1
Specification-Vendor: AMQP Working Group (www.amqp.org)
Implementation-Title: RabbitMQ
Implementation-Version: 3.3.5
Implementation-Vendor: Rabbit Technologies Ltd. (www.rabbitmq.com)

通常の vim 編集コマンドを使用して数行を変更します。

press 'i' to enter insert mode
edit your lines
press :wq<enter> to write and quit

jar 内のファイルのリストに戻り、終了します。

:q <enter>

変更が永続的かどうかを確認します。

Follow the above steps again to inspect the file again, 
the change should still be there.

答え3

私にとってはこれで十分でした:

unzip -l <jarfile>

答え4

.jarファイルは基本的にファイルだと思います.zipヒューズ-ジップうまくいくかもしれない。

関連情報