Decompile Java Jar



JD Project uses JD- GUI. This is an easy-to-use and interactive graphical interface. The decompiler displays the source code during the debugging process. Cavaj is a free Java decompiler that you can use to convert bytecode, ZIP and JAR files into Java source code. It can also come in handy when you want to decompile Java applets. Now place the apk you want to decompile in place-apk-here-for-modding 6. Place a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder. Preferebly it should be from the same package of apk/same apks of a Rom which you placed in the place-apk-here-for-modding folder.

What is Java Decompiler ?

Java decompiler converts .class file into java source code. In other words, decompiler converts bytecode into readable .java format.You can use java decompiler to look into the code of predefined java classes like HashMap, HashSet , ArrayList etc. You can find out how Sun/Oracle java developers wrote the java classes which are currently used by billion of devices in the world.
Java source code from which the .class file has been generated will not exactly match the java source code generated from the java decompiler. But most of the code will be same.

Read Also : Java 8 Features
After installing java, you can find the predefined java classes in the rt.jar inside JRE folder. Unzip rt.jar and all the predefined java classes will be present in the bytecode(.class) format. By using java decompiler, I have written the articles how HashMap works in java, how HashSet works in java. So let's find out best java decompilers which I have used and now I am recommending it to you.

Best Java Decompilers


1. JDProject
JDProject is one of the most frequently used java decompiler offline.It is developed to decompile java 5 or later versions(as of now till java8). It is available for Windows, Mac OS and Linux. It is a best decompiler for eclipse and intellij too as it provides plugin for each platform. JD-Eclipse is a plug-in for the Eclipse platform while JD-Intellij is a plug-in for Intellij IDEA.

Java Decompiler Download


You can download JDProject java decompiler from here

2. Procyon
Procyon is a java decompiler developed by Mike Strobel. Procyon decompiler handles java language enhancements from jdk 1.5 and beyond that most other decompilers don't. Procyon does well with enum declarations, annotations and java 8 lambdas and method references. You can find the wiki here comparing Original code, Procyon decompiler code and JD decompiler code. Although wiki above makes Procyon looks good, but I still prefer JDProject over Procyon. Procyon is relatively new and still work in progress.
3. Cavaj Java Decompiler
If you are a Windows user, then Cavaj is a good option as a decompiler. It is simple to use and decompiles nearly any java class file. The main drawback of Cavaj is that it lacks syntax highlighting.
Also, it is not available for Mac or Linux OS. In short, it is a freeware standalone windows application which converts bytecode(.class) files to java source code.
4. DJ Java Decompiler
DJ Java Decompiler is yet another standalone windows application. It is available for Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 8, 8.1 and 10. You don't need to have the JVM (Java Virtual Machine) or any other java JDK installed. The main advantage of DJ Java Decompiler is that you can decompile more than one java class file at one time. DJ Decompiler enables users to users to save, print, edit and compile the generated java code.
5. JBVD

Decompile Java Jar File Online

JarJBVD stands for java bytecode viewer and decompiler. It is based on the javassist open source library. It is only available for Windows OS. JBVD requires java to be installed on your device to work.
6. AndroChef
AndroChef is also a windows based java decompiler application. With AndroChef Java Decompiler you can decompile apk., dex, jar and java class-files. It's simple and easy. AndroidChef supports Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 8, 8.1 and 10. AndroChef successfully decompiles java6, java 7 and java 8 .jar and .class files.

Decompile Java Jar
CFR stands for Class File Reader. It is completely written in java 6. It supports latest features of java8 like lambdas while decompiling. You do not need to worry if you are using java 8. The only drawback of this decompiler is that it is not an open source program. Although, it has a command line tool which is ideal in making the decompiling process efficient and faster.
8. Fernflower
Fernflower is an analytical decompiler for java. It is used to decompile class, zip and jar file extensions. It is still under development.

Conclusion

There are many options available for java decompiler. If you have MacOS ,Linux OS or looking for eclipse,intellij plugin then go for JDProject. For Windows OS there are many options available like DJ decompiler, JBVD, AndroChef, Cavaj, JDProject. Please mention in the comments if you come across any java decompiler which is not mention in the above list. Thats all, I have shared the 8 best java decompilers for java developers.

To totally unlock this section you need to Log-in


Login

In software terms, JAR (Java Archive) is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file to distribute application software or libraries on the Java platform.

Typically, the contents of any JAR file can be viewed by extracting the JAR file with the help of Tools like 7zip, WinZIP or WinRAR. Once You have successfully extracted the contents of the JAR file, you will get a lot of files with file extension '.class' and these class files are not in human readable format.

So, to overcome this problem and to view the original JAVA source code hidden inside these class files stored inside the JAR file container, we use a tool called JD-GUI.

JD stands for 'Java Decompiler'. It is a standalone graphical utility that displays Java source codes of .class files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.

First, we need to download the JD-GUI software:

  • Download Windows Version.
  • Download Linux Version.
  • Download Mac Version.
  • Now, Extract the ZIP file and you will get these files (we are showing only Windows version), then double click on JD-GUI icon:

And You get the home screen like the following:

Click on File - > Open and choose any JAR file of your choice:

After opening JAR file, you will get a window like this:

Now click on the + icon to expand and view the contents of the packages.

NOTE: '.class' files are found inside these packages.

Here, our package is 'bruteCUI' and then we get a list of '.class' files. Now click on any class file to view its contents:

You can view the contents and any class files and understand how exactly the java program was coded by the developer. This technique can be used to reverse engineer or to decompile any JAR file.

Extracting the Contents of a JAR File

Java Decompiler Free

The basic command, using command line, to use for extracting the contents of a JAR file is:

jar xf jar-file [archived-file(s)]

Let's look at the options and arguments in this command:

  • The x option indicates that you want to extract files from the JAR archive.
  • The f options indicates that the JAR file from which files are to be extracted is specified on the command line, rather than through stdin.
  • The jar-file argument is the filename (or path and filename) of the JAR file from which to extract files.
  • archived-file(s) is an optional argument consisting of a space-separated list of the files to be extracted from the archive. If this argument is not present, the Jar tool will extract all the files in the archive.

As usual, the order in which the x and f options appear in the command doesn't matter, but there must not be a space between them.

Decompile Java Jar File

When extracting files, the Jar tool makes copies of the desired files and writes them to the current directory, reproducing the directory structure that the files have in the archive. The original JAR file remains unchanged.

CAUTION: When it extracts files, the Jar tool will overwrite any existing files having the same pathname as the extracted files.

Let's extract some files from the TicTacToe JAR file we've been using in previous sections. Recall that the contents of TicTacToe.jar are:

Decompile Java Jar Eclipse

Decompile java jar
META-INF/MANIFEST.MF
TicTacToe.class
TicTacToe.class
TicTacToe.java
audio/
audio/beep.au
audio/ding.au
audio/return.au
audio/yahoo1.au
audio/yahoo2.au
example1.html
images/
images/cross.gif
images/not.gif

Suppose you want to extract the TicTacToe class file and the cross.gif image file. To do so, you can use this command:

jar xf TicTacToe.jar TicTacToe.class images/cross.gif

This command does two things:

  • It places a copy of TicTacToe.class in the current directory.
  • It creates the directory called images, if it doesn't already exist, and places a copy of cross.gif within it.
  • The original TicTacToe JAR file remains unchanged.

As many files as desired can be extracted from the JAR file in the same way. When the command doesn't specify which files to extract, the jar tool extracts all files in the archive. For example, you can extract all the files in the TicTacToe archive by using this command:

jar xf TicTacToe.jar

Download

You will be to reach the JD GUI's author site and download from Heelpbook.net this program by login into Heelpbook.net. It's totally free.

[wpfilebase tag='file']
[wpfilebase tag='file']





Comments are closed.