Home  >  Article  >  Java  >  How to decompile class files into java files

How to decompile class files into java files

青灯夜游
青灯夜游Original
2021-04-26 14:00:5828711browse

Method: 1. Download the "jad.exe" plug-in and place it in the same directory as the ".class" file; 2. Open the cmd command window and use the cd command to enter the directory where "Jad.exe" is located. ;3. Execute the "Jad -d java file storage path -sjava class file path" command.

How to decompile class files into java files

The operating environment of this tutorial: windows7 system, java8 version, DELL G3 computer.

1. Tools/Materials

jad.exe decompilation plug-in

The download address can be found at:

https://varanekas.com/jad/

ttp://pan.baidu.com/s/1qWmNlww

##2. Method/step

Explanation

    Among the many JAVA decompilation tools, there are several very famous tools that use the same core Engine - JAD, which mainly includes: Front End
  • Plus, mDeJava, Decafe Pro, Cavaj Java Decompiler, DJ Java
    Decompiler, NMI's Java Class
    Viewer and domestic JAVA source code decompilation experts, etc. . JAD itself is a command line tool without a graphical interface. Most of the above tools just add a graphical interface based on the JAD kernel. The common selection of so many products is enough to prove JAD's distinguished position in the field of JAVA decompilation.

Operation

Place jad.exe and .class files in the same directory (not necessary, optional, will be discussed later Explanation)

How to decompile class files into java files

Start-Run (or Win R)-cmd to open the system command window and enter the directory where Jad.exe is located

For example:

f: 
cd F:\Jad

How to decompile class files into java files

Enter the command

Jad -d F:\Jad\test -sjava test\*.class Press Enter to generate the Java file

How to decompile class files into java files

Example:


Jad -d F:\Jad\test -sjava test\*.class

How to decompile class files into java files
Remarks: *.class * is a wildcard character, this directory is selected by default Download all .class files. If you only need to decompile a certain .class file, you can directly write the file name .class

, such as:

Jad -d F:\Jad\test -sjava test\CaseInfoSaveAction. class

Jad command--Help prompt:

-a - Use JVM byte format to annotate the output

-af - Same as -a, But use the full name when annotating
-clear - clear all prefixes
-b - output extra brackets (e.g., if(a) { b(); }, default: no)
-d - Specify the file directory of the output file
-dead - Attempt to decompile the dead part of the code (default: no)
-disass - Do not use bytecode to decompile (no JAVA source generated )
-f - Output the entire name, whether it is a class or a method
-ff - Output the members of the class before the method (default: after methods)
-i - Output the default of all variables Initial value
-l- Split strings into the specified number of blocks of characters (default: no)
-lnc - Annotate the output file with line numbers (default: no)
- nl - split strings using newline character (default: no)
-nodos - do not check whether the class file is written in dos mode (CR before NL, default: check)
-nocast - do not generate auxiliary files
-nocode - Do not generate method source code
-noconv - Do not convert java definers (default: do)
-noctor - Do not allow empty constructors to exist
-noinner - Turn off Support for inner classes (default: turn on)
-nolvt - Ignore table information for local variables
-nonlb - Do not output a newline before opening a parenthesis (default: do)
-o - Overwrite output without confirmation (default: no)
-p - Send decompiled code to standard output STDOUT (e.g., for piping)
-pa - Prefix used to generate all packages in the source file
-pc - prefix for classes with numeric names (default: _cls)
-pe - prefix for exception names not used (default: _ex)
-pf - prefix for fields with numeric names (default) :_fld)
-pi - use.
-pl - Prefix for local variables with numeric names (default: _lcl)
-pm - Prefix for methods with numeric names (default: _mth)
-pp - Prefix with numeric names Method parms prefix (default: _prm)
-pv - Pack fields with the same type into one line (packfields)
-r - Restore package directory structure
-s - Output file extension (default: .jad)
-space - output space between keywords (if, while, etc.) and expressions
-stat - displays the total number of classes/methods/fields processed
-t - uses spaces Indent (default: 4)
-t -Use tabs instead of spaces for indentation
-v -Display method names during decompilation

Recommended related video tutorials: Java video tutorial

The above is the detailed content of How to decompile class files into java files. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more