Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract classes from .jar file?

Tags:

java

jar

I have .jar file. I tried running command jar xf my.jar it gave nothing. I tried using JD GUI, but it gave me this message: Invalid input file '/home/hey/Desktop/my.jar'.

Does it mean I can't extract classes from this .jar file?

like image 863
good_evening Avatar asked Feb 01 '12 03:02

good_evening


2 Answers

for linux users

unzip your.jar
like image 79
useless Avatar answered Sep 21 '22 20:09

useless


If you wish to extract a file from the Jar file, use the following command:

jar xf jar-filename archived-files

The x option indicates we wish to extract files, the f option indicates from a jar file, the jar-filename is the filename of the jar file to extract from and the archived-files are the files to extract.

We can also extract all files by simply not specifying which files to extract:

jar xf project.jar

Note: If it's not Accessible do like as @Legend told, Open With WinRaR check weather it's a proper .jar or .zip file. If it's not opening with winrar there may be problem in .jar/.zip.

like image 40
Chandra Sekhar Avatar answered Sep 21 '22 20:09

Chandra Sekhar