Development Tip

Java 클래스 파일을 "디 컴파일"하려면 어떻게합니까?

yourdevel 2020. 10. 3. 12:07
반응형

Java 클래스 파일을 "디 컴파일"하려면 어떻게합니까? [닫은]


클래스 파일을 디 컴파일하기 위해 어떤 프로그램을 사용할 수 있습니까? 실제로 Java 코드를 얻습니까, 아니면 JVM 어셈블리 코드입니까?

이 사이트의 Java 성능 질문에서 Java 클래스 파일을 "디 컴파일"한 사람들의 응답을 자주보고 컴파일러가 특정 항목을 최적화하는 방법을 확인합니다.


2016 년 2 월 업데이트 :

www.javadecompilers.com 은 JAD를 다음과 같이 나열합니다.

가장 인기있는 Java 디 컴파일러이지만 주로이 시대에만 해당됩니다. C ++로 작성되었으므로 매우 빠릅니다.
오래되고 지원되지 않으며 Java 5 이상을 올바르게 디 컴파일하지 않습니다.

따라서 마일리지는 최근 jdk (7, 8)에 따라 다를 수 있습니다.

같은 사이트에 다른 도구가 나열되어 있습니다.

Salvador Valencia댓글 (2017 년 9 월) 에서 언급했듯이 javadecompiler .class파일을 클라우드에 업로드 하고 디 컴파일 된 코드를 반환 하는 SaaS를 제공합니다 .


원문 답변 : 2008 년 10 월

  • J2SE 5.0 (Java SE 5)의 주요 기능을 정의하는 JSR 176의 최종 릴리스가 2004 년 9 월 30 일에 게시되었습니다.
  • Pavel Kouznetsov가 작성한 유명한 Java 디 컴파일러 인 JAD가 지원하는 최신 Java 버전은 JDK 1.3 입니다.
  • "DJ Java Decompiler"또는 "Cavaj Java Decompiler"와 같이 오늘날 인터넷에서 다운로드 할 수있는 대부분의 Java 디 컴파일러는 JAD로 구동됩니다. Java 5 소스를 표시 할 수 없습니다.

Java Decompiler (또 다른 Fast Java decompiler)에는 다음이 있습니다.

  • Java 5+ ".class"파일의 디 컴파일 및 분석을위한 명시 적 지원 .
  • 멋진 GUI :

스크린 샷

JDK 1.1.8부터 JDK 1.7.0까지의 컴파일러 및 기타 ( Jikes , JRockit 등)에서 작동합니다.

실제로 완벽하게 작동 하는 온라인 라이브 데모 버전 이 있습니다! 페이지에 jar 파일을 놓으면 아무것도 설치하지 않고도 디 컴파일 된 소스 코드를 볼 수 있습니다.


몇 가지 디 컴파일러가 있습니다 ... 빠른 검색 결과 :

  1. Procyon : 오픈 소스 (Apache 2) 및 활발히 개발
  2. Krakatau : 오픈 소스 (GPLv3) 및 활발히 개발
  3. CFR : 오픈 소스 (MIT) 및 활발히 개발
  4. JAD
  5. DJ 자바 디 컴파일러
  6. 모카

그리고 더 많은.

이들은 Java 코드를 생성합니다. Java에는 JVM 바이트 코드 ( javap ) 를 볼 수있는 기능이 있습니다 .


Java 소스 코드를 보려면 일부 디 컴파일러를 확인하십시오. jad를 검색하십시오 .

바이트 코드를 보려면 JDK와 함께 제공되는 javap사용하십시오 .


여러 번 시도해 보았는데 Procyon 이 가장 잘 작동하는 것 같았습니다. 현재 개발 중이며 Java 최신 버전의 많은 기능을 지원합니다.

다음은 내가 시도한 다른 것입니다.

  • CFR
    • 유망하지만 종종 실패한 메서드 디 컴파일. 나는 이것을 계속 주시 할 것이다. 또한 최신 Java 기능을 지원하여 적극적으로 개발되었습니다.
  • 크라 카타 우
    • 원본 소스를 재구성하는 대신 동등한 Java 코드를 출력하려고한다는 점에서 다른 접근 방식을 취합니다. 이는 난독 화 된 코드에 대해 더 나은 결과를 얻을 수 있습니다. 내 테스트에서 그것은 대략 Procyon과 동등했지만 여전히 다른 것을 가지고 있다는 것이 좋습니다. -skip명령 줄 플래그 를 사용해야 만 오류가 발생하지 않습니다. 활발하게 개발되었으며 흥미롭게도 Python으로 작성되었습니다.
  • JD-GUI
  • JAD
    • Worked, but only supports Java 1.4 and below. Also available as an Eclipse plugin. No longer under development.

I use JAD Decompiler.

There is an Eclipse plugin for it, jadeclipse. It is pretty nice.


Procyon includes a decompiler. It is FOSS.


Soot is an option for newer Java code. At least it has the advantage of still being recently maintained...

Also, Java Decompiler is a decompiler with both a stand-alone GUI and Eclipse integration.

Lastly, Jdec hasn't been mentioned, though it's not as polished as other options.


JD-GUI is really good. You could just open a JAR file and browse through the code as if you are working on an IDE. Good stuff.


Here's a list of decompilers as of Feb 2015:

Procyon, open-source, https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler

CFR, free, no source-code available, http://www.benf.org/other/cfr/

JD, free for non-commercial use only, http://jd.benow.ca/

Fernflower, open-source, https://github.com/fesh0r/fernflower,

JAD – given here only for historical reason. Free, no source-code available, http://varaneckas.com/jad/ Outdated, unsupported and does not decompile correctly Java 5 and later.

You may test above-mentioned decompilers online, no installation required and make your own educated choice.

Java decompilers in the cloud: http://www.javadecompilers.com/


There are a few programs you can use. You will get the actual Java code, but sometimes the code will have been obfuscated so methods are named by one letter or number or a random mix of letters and numbers.

DJ Decompiler Mocha


Most decompilers for Java are based on JAD. It's a great tool, but unfortunately hasn't been updated for a while and does not handle Java 1.5+ classes very well. I have not seen any tools that will properly handle 1.5+ classes.


Take a look at cavaj.


All of the JAD links listed so far far seem to be broken, so I found this site. Works great (for Linux, at least)! On Ubuntu 11.10 I had to download the static one for whatever reason.

http://www.varaneckas.com/jad


  • JAD is one that works and is simple.

  • Also, if you just want to see the methods, use javap.


If you want to see how the Java compiler does certain things, you don't want decompilation, you want disassembly. Decompilation involves transforming the bytecode into Java source, meaning that a lot of low level information is lost, and if you're wondering about compiler optimization, this is probably the very information you're interested in.

Anyway, I happen to have written an open source Java disassembler. Unlike Javap, this works even on highly pathological classes, so you can see what obfuscation tools are doing to your classes as well. It can also do decompilation, though I wouldn't recommend it.


JAD doesn't work for me (Ubuntu 11.10 issue) so I've moved forward and sopped on JODO. At least it has Open Java source code and been able to decompile my .class properly.

I recommend to check out 'branches/generic' branch first. The trunks is not stable.


On IntelliJ IDEA platform you can use Java Decompiler IntelliJ Plugin. It allows you to display all the Java sources during your debugging process, even if you do not have them all. It is based on the famous tools JD-GUI.

여기에 이미지 설명 입력


With AndroChef Java Decompiler you can decompile apk, dex, jar and java class-files. It's simple and easy. AndroChef JD is based on FernFlower. You can evaluate it in 10 free uses.

AndroChef는 제네릭, 열거 형 및 주석과 같은 Java 언어 기능을 지원합니다. 일부 연구에 따르면 AndroChef Java Decompiler는 기존 Java 컴파일러로 생성 된 Java 애플리케이션의 98.04 %를 디 컴파일 할 수 있으며 이는 매우 높은 복구율입니다. Java 및 Dalvik 바이트 코드 (DEX, APK)를 읽을 수있는 Java 소스로 디 컴파일 할 수있는 간단하지만 강력한 도구입니다.


OSX의 경우 추천 : jarzilla 또는 JD-GUI

둘 다 항아리, 전쟁 등을 볼 수 있습니다. 파일 내용을 확인하고 그 안의 모든 클래스 파일을 디 컴파일합니다.

Jarzilla : https://code.google.com/p/jarzilla/
JD-GUI : http://jd.benow.ca/

참고 URL : https://stackoverflow.com/questions/272535/how-do-i-decompile-java-class-files

반응형