How to get Java Source code from jar files

by Rakesh on January 1, 2013

In the post we learnt how to get Java Source Code from .apk files, Here in this post we will learn how to get Java Source files from .jar files.

what is .jar file ?

jar is acronym of the Java Archive file. basically it contains all java class files and packages that are required or created to build an application. Jar file may also store images and metadata files that are associated with application. Jar file allows Java runtime to efficiently deploy a set of classes and their associated resources. jar files can be created using the command “jar” that is installed when Java Virtual Machine is installed.

We can extract contents of .jar file using “jar -xf filename.jar” but it gives .class files and other metadata files that are associated with application. Using jar command does not give us .java files from jar file. So in order to get .java files from .jar file we need to use a tool called Java Decompiler which you can download from given link.

4 Easy steps to get java files from .jar files

  • After downloading  java decompiler from above link extract it and open jd-gui.exe by double clicking it.
  • Now goto Files menu and select open File menu press ctrl+o and browse to the location where you have stored your .jar file and select .jar file and click open
  • All packages and java files will be loaded and now you just need to save those source files by selecting the menu “save all sources” from Files menu.
  • Select the location where you want to save java source files and press save button, it will create zip file that you need to extract in order to view each source file.

Download Java Decompiler


Comments on this entry are closed.

Previous post:

Next post:

Güncel Haberler