Press enter to see results or esc to cancel.


Check / Export the resources contained in Java .jar files-Command Prompt

Here is the steps how you can extract and see the contents of a jar file.

  1. Lets take an example by checking contents available in the jar org.apache.commons.io.jar
  2. Make sure you have installed the java in your pc.
  3. Open command prompt and navigate to location where you have installed java in your PC. In my pc it is installed in the path “C:\Program Files\Java\jdk1.8.0_131\bin”.

    So just type the below command in Command Prompt and press enter.

    cd "C:\Program Files\Java\jdk1.8.0_131\bin"
    
    
    
  4. The command for checking the jar resources is,

    jar tf jar_name.jar
    

    So in my PC the jar is located in another folder, “C:\Users\MIRITPC\Desktop\jar”
    So the modified command will be.

    jar tf "C:\Users\MIRITPC\Desktop\jar\org.apache.commons.io.jar"
    
  5. Now just execute this command in the Command Prompt. You can see the files of the jar in Command Prompt window.

    jar tf "C:\Users\MIRITPC\Desktop\jar\org.apache.commons.io.jar"
    
    
    
    META-INF/
    META-INF/MANIFEST.MF
    org/
    org/apache/
    org/apache/commons/
    org/apache/commons/io/
    org/apache/commons/io/filefilter/
    org/apache/commons/io/input/
    org/apache/commons/io/output/
    META-INF/LICENSE.txt
    META-INF/NOTICE.txt
    org/apache/commons/io/CopyUtils.class
    org/apache/commons/io/DirectoryWalker$CancelException.class
    org/apache/commons/io/DirectoryWalker.class
    org/apache/commons/io/EndianUtils.class
    org/apache/commons/io/FileCleaner$Reaper.class
    org/apache/commons/io/FileCleaner$Tracker.class
    org/apache/commons/io/FileCleaner.class
    org/apache/commons/io/FileDeleteStrategy$ForceFileDeleteStrategy.class
    org/apache/commons/io/FileDeleteStrategy.class
    org/apache/commons/io/FileSystemUtils.class
    org/apache/commons/io/FileUtils.class
    org/apache/commons/io/FilenameUtils.class
    org/apache/commons/io/HexDump.class
    org/apache/commons/io/IOCase.class
    org/apache/commons/io/IOUtils.class
    org/apache/commons/io/LineIterator.class
    org/apache/commons/io/filefilter/AbstractFileFilter.class
    org/apache/commons/io/filefilter/AgeFileFilter.class
    org/apache/commons/io/filefilter/AndFileFilter.class
    org/apache/commons/io/filefilter/CanReadFileFilter.class
    org/apache/commons/io/filefilter/CanWriteFileFilter.class
    org/apache/commons/io/filefilter/ConditionalFileFilter.class
    org/apache/commons/io/filefilter/DelegateFileFilter.class
    org/apache/commons/io/filefilter/DirectoryFileFilter.class
    org/apache/commons/io/filefilter/EmptyFileFilter.class
    org/apache/commons/io/filefilter/FalseFileFilter.class
    org/apache/commons/io/filefilter/FileFileFilter.class
    org/apache/commons/io/filefilter/FileFilterUtils.class
    org/apache/commons/io/filefilter/HiddenFileFilter.class
    org/apache/commons/io/filefilter/IOFileFilter.class
    org/apache/commons/io/filefilter/NameFileFilter.class
    org/apache/commons/io/filefilter/NotFileFilter.class
    org/apache/commons/io/filefilter/OrFileFilter.class
    org/apache/commons/io/filefilter/PrefixFileFilter.class
    org/apache/commons/io/filefilter/SizeFileFilter.class
    org/apache/commons/io/filefilter/SuffixFileFilter.class
    org/apache/commons/io/filefilter/TrueFileFilter.class
    org/apache/commons/io/filefilter/WildcardFileFilter.class
    org/apache/commons/io/filefilter/WildcardFilter.class
    org/apache/commons/io/input/ClassLoaderObjectInputStream.class
    org/apache/commons/io/input/CountingInputStream.class
    org/apache/commons/io/input/DemuxInputStream.class
    org/apache/commons/io/input/NullInputStream.class
    org/apache/commons/io/input/NullReader.class
    org/apache/commons/io/input/ProxyInputStream.class
    org/apache/commons/io/input/ProxyReader.class
    org/apache/commons/io/input/SwappedDataInputStream.class
    org/apache/commons/io/output/ByteArrayOutputStream.class
    org/apache/commons/io/output/CountingOutputStream.class
    org/apache/commons/io/output/DeferredFileOutputStream.class
    org/apache/commons/io/output/DemuxOutputStream.class
    org/apache/commons/io/output/LockableFileWriter.class
    org/apache/commons/io/output/NullOutputStream.class
    org/apache/commons/io/output/NullWriter.class
    org/apache/commons/io/output/ProxyOutputStream.class
    org/apache/commons/io/output/ProxyWriter.class
    org/apache/commons/io/output/TeeOutputStream.class
    org/apache/commons/io/output/ThresholdingOutputStream.class
    
  6. Now if you want to export the files into a txt file just execute the command as,

    jar tf "C:\Users\MIRITPC\Desktop\jar\org.apache.commons.io.jar" > "C:\Users\MIRITPC\Desktop\jar\jinu.txt"
    

    It will export the files into a txt file in the same location of jar.


Tags