How to Convert a Class File to a Java File?

2020-02-23 16:04:11来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

How to Convert a Class File to a Java File?

What is a programming language?

Before introducing compilation and decompilation, let's briefly introduce the Programming Language. Programming languages ??are divided into low-level languages ??and high-level languages.

Machine language and assembly language are low-level languages, and programs are written directly with computer instructions.
C, C ++, Java, and Python are high-level languages. Programs are written in statements, which are abstract representations of computer instructions.

What is compilation?

There are two languages ??mentioned above, a low-level language and a high-level language. Simple understanding: low-level languages ??are languages ??recognized by computers, and high-level languages ??are languages ??recognized by programmers.
So how do you switch from a high-level language to a low-level language? This process is actually compiling.

The process of translating source code programs written in high-level computer languages ??that are easy to write, read, and maintain into low-level machine language programs that can be interpreted and run by computers is compilation. The tool responsible for this process is called a compiler

Now we know what a compiler is and what a compiler is. Different languages ??have their own compilers. The compiler responsible for compiling in Java is a command: javac

After we write a HelloWorld.java file, we can use the javac HelloWorld.java command to generate a HelloWorld.class file. This class file is a file recognized by the JVM. Usually we think of this process as the compilation of the Java language. In fact, the class file is still not a language that the machine can recognize, because the machine can only recognize the machine language, and the JVM needs to convert this class file type bytecode into a machine language that the machine can recognize.

javac is a Java language compiler included in the JDK. The tool can compile source files with the extension .java into bytecodes with the extension .class that can run in the Java virtual machine.

What is decompilation?

The process of decompiling is just the opposite of compiling, that is, restoring the compiled programming language to an uncompiled state, that is, finding the source code of the programming language. Is to translate the language that the machine understands into a language that the programmer can understand. Decompilation in the Java language generally refers to converting a class file into a java file.

With decompilation tools, we can do many things. The main function is that with decompilation tools, we can understand the bytecode generated by the Java compiler. For example, we can gain insight into the principles behind Java's syntactic sugar.

Java commonly used decompilation tools

This article mainly introduces 4 Java decompilation tools: javap, jad and cfr, and visual decompilation tool JD-GUI.Or you can use online tool wesite - Java Decompiler Online.

What is Java Decompiler Online?

Java Decompiler Online is an online tool for decompiling class files to java source files which supports .class, .jar, .zip and other file formats. It's the best online tool to decompile java code quickly and intelligently.

3 Steps to Decompiler Java Class File

Step 1: Choose Java Class File

Drag the specified java class file to the upper area or click the above button to select the file, enter the verification code and confirm to upload the file.

Step 2: Waiting for Decompilation

Java class file will be decompiled after the file is uploaded. Please wait patiently if the file is too large.

Step 3: Download The Decompiled Java Source Code File

Open the file in the corresponding folder, and click the download button in the upper right corner to download.

By the way, please contact us if you have any question. Don't miss to share on facebook etc.

转载,请保留原文地址,谢谢 ~


原文链接:https://www.cnblogs.com/Alandre/p/12348862.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:spring cloud微服务快速教程之(十) gateway 服务网关

下一篇: sun.misc.Unsafe中一些常用方法记录