Decompile a Windows executable (.exe) written in Java

Very often the .jar executable files are converted in .exe executable to work with Windows.

 
Java is a programming language that can be decompiled using simple decompilers, in a lawfully way
The most famous decompiler is fernflower, you find all about it in this forum. Anyway, I often use JD-GUI, the download can be found here
Download one of those and put it in folder in the Desktop.
Or search for some decompilers online on Google, you always find something.
 
We will see two methods, one using JD-GUI and the other using fernflower.
 
We will decompile the 1.5.2 orginal Minecraft Launcher, that can be found here. 
Mine is called “Minecraft.exe”, yours should be called “Minecraft-1.5.2.exe” (maybe you will not have the “.exe” part, we will see later how to get it).
 
 

 

 

First method – Decompile by using JD-GUI

Move the downloaded file in a new folder and change the extension to “.exe” to “.zip”

Open JD-GUI by double clicking the jar executable.

Now open the zip file we just created go to File>Open File…> and choose the file we created

Now you JD-GUI workspace should look like this.

Go To File>Save All Files> and choose the directory when you want to save the zip file with the sources. You should import this file into an IDE to make it work.

 

 

Second method – Decompile by using fernflower (via command prompt)

  1. Rename “Minecraft.exe” in “Minecraft.jar”, with the method used for the JD-GUI to rename it in .zip
  2. Open the Command Prompt, hitting the button tasto Windows + R, typing cmd and hitting Enter
  3. Use the cd command to move to the directory the fernflower is in.
  4. Now in the Command Prompt write  java -jar fernflower.jar Minecraft.jar decomp/
  5. This will open the fernflower(fernflower.jar), sets the file to decompile to Minecraft.zip and put the decompiled jar in the decomp sub-folder in the fernflower folder.
  6. Enter the decomp sub-folder in the fernflower folder and rename the “Minecraft.jar” in “Minecraft.zip”
  7. Now you have your decompiled !   

In both cases, you will have to import the decompiled source code into an IDE.

I hope this was useful for your as it was for me! 😀