What is the compilation and decompile of Java code?

Source: Internet
Author: User

Transferred from: http://java.tedu.cn/ask/203119.html

Compilation and decompile of Java code

First, what is the compilation

1, the process of generating the target program from the source program written by the compiler program from the source language.

2, using the compiler program to generate the action of the target program. Compilation is the high-level language into the computer can recognize the 2-language, the computer only know 1 and 0, the compiler to the people familiar with the language into 2-binary. The process of translating a source program into a target program is divided into five stages: lexical analysis, grammatical analysis, semantic inspection and intermediate code generation, code optimization, and target code generation. Mainly is the lexical analysis and grammar analysis, also known as the source program analysis, the analysis process found that there are grammatical errors, give the prompt information.

Second, what is the anti-compilation

Computer software reverse engineering (Reverse Engineering), also known as Computer software restoration project, refers to the "reverse analysis and research" work of the Target program (executable program) of other people's software, in order to deduce the ideas, principles, structures, algorithms, processing processes and Design elements, such as the Run method, may derive the source code in some specific cases. Decompile as a reference when developing your own software, or directly in your own software PRODUCT.

Compilation and anti-compilation of Java classes

When we first learned Java, we were exposed to two commands: Javac and Java, and then we knew that Javac was used to compile Java classes, that is, to compile the Helloworld.java files we have written into a helloworld.class file.

Class files break the tradition of languages such as C or C + +, and programs written in these traditional languages are usually compiled first and then connected to a separate binary file that specifically supports specific hardware platforms and operating systems. Typically, binary executables on one platform do not work on other platforms. The Java class file is a binary file that can run on any hardware platform and operating system that supports Java virtual machines.

Then the anti-compilation, is through the Helloworld.class file to get the Java file (or the programmer can read Java files)

Four, when will use the anti-compilation

1, we have only one class file, but we do not understand the Java class file, then we can decompile it into a file we can understand.

2, Learning Java process, each version of the JDK will be added more and more grammar sugar, sometimes we want to know some Java implementation details, we can use the anti-compilation.

Five, anti-compilation tools

1, JAVAP

2, Jad: official website (wall crack recommended)

Client:

You can download the executable file on the official website, find the corresponding version of the corresponding operating system, and then install it.

Because I am using the Linux operating system, so I downloaded the Linux version of the tool, the tool will be downloaded after the implementation of a file, as long as the execution of the file in the same directory execution./jad Helloworld.class will generate the Helloworld.jad file in the current directory, which is the Java code we are familiar with.

Eclipse Plugin:

Download the plugin's jar package on the official website and place the jar package in the Eclipse's Plugins directory ' open Eclipse,eclipse->window->preferences->java, At this point you will find a jadclipse option, click, enter the location where you just placed jad.exe in path to Decompiler, or create a directory of temporary files. Of course, under the jadclipse there are also some sub-options, such as debug,directives, according to the default configuration. After the basic configuration is complete, we can check the default open mode of class file, Eclipse->window->preferences->general->editors->file Associations we can see that the class file is opened in two ways, Jadclipse and Eclipse have their own class files Viewer, and Jadclipse is the default. Complete configuration, the following we can view the source code, select the class to see, press F3 to view the source code

What is the compilation and decompile of Java code? Go

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.