SlideShare a Scribd company logo
JAVA DE-COMPLIER
1
13-03-2015
Contents
• Introduction
• Examples of base program
• Steps to de-compile java
• Input of the program
• Algorithm
• Output of the program
2
13-03-2015
Introduction
• A de-compiler is a computer program that performs the reverse operation to that of
a compiler.
• The term de-compiler is most commonly applied to a program which translates
executable programs (the output from a compiler) into source code in a high level
language, when compiled, will produce an executable whose behavior is the same as
the original executable program.
13-03-2015
3
Steps to de-compilation
• Parse Java class file
• Recreate signatures
• Convert byte code to Java executable code
Verify byte code
Perform trivial conversion
Reconstruct control structures
Scope & Type Variables
• Simplify code
13-03-2015
4
Examples of base program
Consider the following example :
Public static int plus(int a, int b)
{
int c = a+b;
return c;
}
13-03-2015
5
• Byte code :
Public static int plus(int, int)
Code :
Stack=2, locals=3, arguments =2;
0 : iload_0 // load int a
1 : iload_1 // load int b
2 :
13-03-2015
6
• If- else :
public int greaterThen(int intOne, int intTwo)
{
if (intOne > intTwo)
{
return 0;
}
else
{
return 1;
}
}
13-03-2015
7
• The above method results in following byte code :
• 0: iload_1
• 1: iload_2
• 2: if_icmple 7
• 5: iconst_0
• 6: ireturn
• 7:iconst_1
• 8: ireturn
13-03-2015
8
• Switch :
public int simpleSwitch(int intOne)
{
switch (intOne)
{
case 0: return 3;
case 1: return 2;
case 4: return 1;
default: return -1;
}
}
13-03-2015
9
• The above code produces following byte code :
0: iload_1
1: tableswitch
{
default: 42
min: 0
max: 4
0: 36
1: 38
2: 42
3: 42
4: 40
}
13-03-2015
10
36: iconst_3
37: ireturn
38: iconst_2
39: ireturn
40: iconst_1
41: ireturn
42: iconst_m1
43: ireturn
13-03-2015
11
• While loop :
public void whileLoop()
{
int i = 0;
while (i < 2)
{
i++;
}
}
13-03-2015
12
• The above code produces following byte code :
0: iconst_0
1: istore_1
2: iload_1
3: iconst_2
4: if_icmpge 13
7: iinc 1, 1
10: goto 2
13: return
13-03-2015
13
• For loop :
public void forLoop()
{
for(int i = 0; i < 2; i++)
{
}
}
The byte code produced by the for loop is similar to while loop.
13-03-2015
14
• Do- while :
public void doWhileLoop()
{
int i = 0;
do
{
i++;
}
while (i < 2);
}
13-03-2015
15
• The above code generates the following byte code :
0: iconst_0
1: istore_1
2: iinc 1, 1
5: iload_1
6: iconst_2
7: if_icmplt 2
10: return
13-03-2015
16
• Try- catch block :
public void tryCatchCatchFinally(int i)
{
Try
{
i = 2;
}
catch (RuntimeException e)
{
i = 3;
}
finally
{
i = 4;
} }
13-03-2015
17
Input of the program
• Input of the program is the byte code generated by Java Virtual Machine(JVM).
Consider the following byte code :
0: iload_0
1: iload_1
2: iadd
3: istore_2
4 : iload_2
5 : return
13-03-2015
18
Algorithm
• Algorithm for Java de-complier.
13-03-2015
19
Output of the program
• The output of the de-complied byte code is java source code .
13-03-2015
20
Thank You
21
13-03-2015

More Related Content

PPSX
Java 8 – completion stage
PPTX
Link quries
PPTX
Lambda expressions java8 - yousry
PPTX
Lex & yacc
PDF
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
DOCX
LEX & YACC
PDF
(1) c sharp introduction_basics_dot_net
PDF
Compilation in c
Java 8 – completion stage
Link quries
Lambda expressions java8 - yousry
Lex & yacc
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
LEX & YACC
(1) c sharp introduction_basics_dot_net
Compilation in c

What's hot (20)

PPT
Verilog Tasks and functions
PDF
Remote Method Invocation, Advanced programming
PPT
Middleware fourth unit
PDF
Intro to elixir metaprogramming
PPTX
Object oriented programming 7 first steps in oop using c++
PDF
Flowex - Railway Flow-Based Programming with Elixir GenStage.
DOCX
Bitstuffing
PPTX
Reactive cocoa 101改
ODP
Pluggable Pipelines
PDF
Whats new in .NET for 2019
PDF
Functions and tasks in verilog
PPTX
Inline functions & macros
PPTX
Python component in mule
PPTX
Massif - the love child of Matlab Simulink and Eclipse
PPTX
PPTX
05 coms 525 tcpip - icmp
PPTX
Inline function in C++
PDF
DOC
Lex tool manual
PDF
Intake 37 ef2
Verilog Tasks and functions
Remote Method Invocation, Advanced programming
Middleware fourth unit
Intro to elixir metaprogramming
Object oriented programming 7 first steps in oop using c++
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Bitstuffing
Reactive cocoa 101改
Pluggable Pipelines
Whats new in .NET for 2019
Functions and tasks in verilog
Inline functions & macros
Python component in mule
Massif - the love child of Matlab Simulink and Eclipse
05 coms 525 tcpip - icmp
Inline function in C++
Lex tool manual
Intake 37 ef2
Ad

Viewers also liked (20)

DOC
Anusha
PDF
c v ziouane
PDF
Strategic R&D collaboration to enable p..
PDF
WTCEME2017 Event Brochure_Updated
DOCX
Short film analysis 'The Moped Diaries' (NOT FINISHED)
PPTX
Group 6 video presentation 5
PPTX
Jorge monsalve actividad1 2_mapac
DOC
Curriculum Vitae-Urs Flueckiger OM152
PDF
인터렉1
PPTX
Homemade flashlight2
PPTX
Guide to tummy tuck surgery
PDF
DOS AmberAdam
PDF
Biomekanisk testning af kørestolsrugbyatleter, Et pilotstudie
PPTX
Netwalk - Un piccolo ecommerce contro i colossi della rete
PDF
Kejang demam-neurology-2012
PPTX
Creative Industries Marketing Plan Presentation - S. Jay (University Assignment)
PDF
NBTC Exhitibition Stands
PPTX
cpd ch 9
PPTX
Baby rats2
DOCX
SUMMARY – RECENT EXPERIENCES 2016 q1
Anusha
c v ziouane
Strategic R&D collaboration to enable p..
WTCEME2017 Event Brochure_Updated
Short film analysis 'The Moped Diaries' (NOT FINISHED)
Group 6 video presentation 5
Jorge monsalve actividad1 2_mapac
Curriculum Vitae-Urs Flueckiger OM152
인터렉1
Homemade flashlight2
Guide to tummy tuck surgery
DOS AmberAdam
Biomekanisk testning af kørestolsrugbyatleter, Et pilotstudie
Netwalk - Un piccolo ecommerce contro i colossi della rete
Kejang demam-neurology-2012
Creative Industries Marketing Plan Presentation - S. Jay (University Assignment)
NBTC Exhitibition Stands
cpd ch 9
Baby rats2
SUMMARY – RECENT EXPERIENCES 2016 q1
Ad

Similar to Java Decompiler (20)

PPTX
Principal Sources of Optimization in compiler design
DOCX
ESL report
PPTX
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
PPTX
No liftoff, touchdown, or heartbeat shall miss because of a software failure
PPTX
Introduction to C ++.pptx
PDF
running stable diffusion on android
PDF
this is lab 1 of course embedded system.
PPT
CS4961-L9.ppt
PPTX
Java developer trainee implementation and import
PDF
Compiler tricks
PDF
Code optimization in compiler design
PDF
Session 9 advance_verification_features
PPTX
Digital signals design Module 2 - HDLs (1).pptx
PDF
Hot Code Replacement - Alexei Sholik
PPTX
Lec01-02 (Topic 1 C++ Fundamentals).pptx
PPT
Embedded _c_
PDF
Improving Java performance at JBCNConf 2015
PPTX
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
PPTX
embedded C.pptx
Principal Sources of Optimization in compiler design
ESL report
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
No liftoff, touchdown, or heartbeat shall miss because of a software failure
Introduction to C ++.pptx
running stable diffusion on android
this is lab 1 of course embedded system.
CS4961-L9.ppt
Java developer trainee implementation and import
Compiler tricks
Code optimization in compiler design
Session 9 advance_verification_features
Digital signals design Module 2 - HDLs (1).pptx
Hot Code Replacement - Alexei Sholik
Lec01-02 (Topic 1 C++ Fundamentals).pptx
Embedded _c_
Improving Java performance at JBCNConf 2015
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
embedded C.pptx

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Well-logging-methods_new................
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Welding lecture in detail for understanding
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPT
Project quality management in manufacturing
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
PPT on Performance Review to get promotions
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
web development for engineering and engineering
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
UNIT 4 Total Quality Management .pptx
Geodesy 1.pptx...............................................
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Well-logging-methods_new................
bas. eng. economics group 4 presentation 1.pptx
OOP with Java - Java Introduction (Basics)
Lecture Notes Electrical Wiring System Components
Welding lecture in detail for understanding
Lesson 3_Tessellation.pptx finite Mathematics
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Project quality management in manufacturing
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT on Performance Review to get promotions
UNIT-1 - COAL BASED THERMAL POWER PLANTS
web development for engineering and engineering
CH1 Production IntroductoryConcepts.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
UNIT 4 Total Quality Management .pptx

Java Decompiler

  • 2. Contents • Introduction • Examples of base program • Steps to de-compile java • Input of the program • Algorithm • Output of the program 2 13-03-2015
  • 3. Introduction • A de-compiler is a computer program that performs the reverse operation to that of a compiler. • The term de-compiler is most commonly applied to a program which translates executable programs (the output from a compiler) into source code in a high level language, when compiled, will produce an executable whose behavior is the same as the original executable program. 13-03-2015 3
  • 4. Steps to de-compilation • Parse Java class file • Recreate signatures • Convert byte code to Java executable code Verify byte code Perform trivial conversion Reconstruct control structures Scope & Type Variables • Simplify code 13-03-2015 4
  • 5. Examples of base program Consider the following example : Public static int plus(int a, int b) { int c = a+b; return c; } 13-03-2015 5
  • 6. • Byte code : Public static int plus(int, int) Code : Stack=2, locals=3, arguments =2; 0 : iload_0 // load int a 1 : iload_1 // load int b 2 : 13-03-2015 6
  • 7. • If- else : public int greaterThen(int intOne, int intTwo) { if (intOne > intTwo) { return 0; } else { return 1; } } 13-03-2015 7
  • 8. • The above method results in following byte code : • 0: iload_1 • 1: iload_2 • 2: if_icmple 7 • 5: iconst_0 • 6: ireturn • 7:iconst_1 • 8: ireturn 13-03-2015 8
  • 9. • Switch : public int simpleSwitch(int intOne) { switch (intOne) { case 0: return 3; case 1: return 2; case 4: return 1; default: return -1; } } 13-03-2015 9
  • 10. • The above code produces following byte code : 0: iload_1 1: tableswitch { default: 42 min: 0 max: 4 0: 36 1: 38 2: 42 3: 42 4: 40 } 13-03-2015 10
  • 11. 36: iconst_3 37: ireturn 38: iconst_2 39: ireturn 40: iconst_1 41: ireturn 42: iconst_m1 43: ireturn 13-03-2015 11
  • 12. • While loop : public void whileLoop() { int i = 0; while (i < 2) { i++; } } 13-03-2015 12
  • 13. • The above code produces following byte code : 0: iconst_0 1: istore_1 2: iload_1 3: iconst_2 4: if_icmpge 13 7: iinc 1, 1 10: goto 2 13: return 13-03-2015 13
  • 14. • For loop : public void forLoop() { for(int i = 0; i < 2; i++) { } } The byte code produced by the for loop is similar to while loop. 13-03-2015 14
  • 15. • Do- while : public void doWhileLoop() { int i = 0; do { i++; } while (i < 2); } 13-03-2015 15
  • 16. • The above code generates the following byte code : 0: iconst_0 1: istore_1 2: iinc 1, 1 5: iload_1 6: iconst_2 7: if_icmplt 2 10: return 13-03-2015 16
  • 17. • Try- catch block : public void tryCatchCatchFinally(int i) { Try { i = 2; } catch (RuntimeException e) { i = 3; } finally { i = 4; } } 13-03-2015 17
  • 18. Input of the program • Input of the program is the byte code generated by Java Virtual Machine(JVM). Consider the following byte code : 0: iload_0 1: iload_1 2: iadd 3: istore_2 4 : iload_2 5 : return 13-03-2015 18
  • 19. Algorithm • Algorithm for Java de-complier. 13-03-2015 19
  • 20. Output of the program • The output of the de-complied byte code is java source code . 13-03-2015 20