4

I am preparing core java and i got following doubt

javap is dis-assembler or de-compiler? what is the difference between them? which java CLI commands are used ?

Bishan
  • 15,211
  • 52
  • 164
  • 258
user3781572
  • 175
  • 1
  • 4
  • possible duplicate of [Is Java a Compiled or an interpreted programming language?](http://stackoverflow.com/questions/1326071/is-java-a-compiled-or-an-interpreted-programming-language) – Sam Hanley Jul 08 '14 at 02:41
  • 4
    @sphanley not the same thing, the question you mention is whether Java is interpreted or compiled, here the question is about the utility javap – morgano Jul 08 '14 at 02:46
  • Side note: Oracle states [here](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html) that "The **javap** command disassembles one or more class files." I'm not sure if they're following "technical" terminology, but it at least seems to match morgano's answer. – awksp Jul 08 '14 at 05:32
  • The `javap` command disassembles one or more class files and shows the byte code information. where as, Decompiling is something which converts these byte codes into java source code. – theinvisible Jul 08 '14 at 06:01
  • @morgano fair enough, I'm not familiar with javap so I assumed that it was a typo and this was just someone asking in poor english whether Java would be disassemlbled or decompiled. – Sam Hanley Jul 08 '14 at 13:04

1 Answers1

8

Javap is just an "informal" dis-assembler, its output gives you information about the bytecode, but is not suitable for it to be used by an "assembler", it is rather for it to be read by a human.

The traditional difference (from the C language world):

  • Compiler: compiles a relatively high-level source code to assembly language
  • Assembler: compiles assembly code to machine code

take your conclusions for "de-compiler" and "dis-assembler"

Sometimes a software that does both steps (disassemble and decompile) is also called a decompiler, but it still depends on the context

morgano
  • 17,210
  • 10
  • 45
  • 56