Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 873  / 2 Years ago, thu, february 3, 2022, 2:12:22

Inside a Ubuntu OS, how can I browse contents in a jar file by terminal?


More From » java

 Answers
4

You could use the command unzip -l [filename] to list the contents of the jar archive file.


First, you might need to install unzip:
sudo apt install unzip


Example of unzip usage on the file gettext.jar:


username@ubuntu-server:~$ unzip -l /usr/share/java/gettext.jar
Archive: /usr/share/java/gettext.jar
Length Date Time Name
--------- ---------- ----- ----
0 2019-03-06 23:31 META-INF/
66 2019-03-06 23:31 META-INF/MANIFEST.MF
5657 2019-03-06 23:31 gnu/gettext/DumpResource.class
699 2019-03-06 23:31 gnu/gettext/GetURL$1.class
1579 2019-03-06 23:31 gnu/gettext/GetURL.class
--------- -------
8001 5 files

Alternatively, you could use the Java JDK's jar command to view the contents of a jar file: jar -tf [filename]. (See https://stackoverflow.com/questions/320510/viewing-contents-of-a-jar-file)


[#1204] Saturday, February 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leddre

Total Points: 180
Total Questions: 113
Total Answers: 108

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
;