Score:0

CLI: How to browse contents in a jar file?

mx flag

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

Score:3
in flag

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)

Score:0
gh flag

Official information:

The basic format of the command for viewing the contents of a JAR file is:

jar tf jar-file

The JAR tool will display additional information if you use the v option:

jar tvf TicTacToe.jar

If you don't have it, you should install jar with

sudo apt install openjdk-11-jdk-headless
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.