Search code examples
javaintellij-ideajavac

difference between javac and bytecode


I understand IntelliJ does everything automatically by clicking on the little green arrow next to my Main class but I'm trying to understand what's happening underneath.

On the internet I've encountered two different things. First is the file created when we do javac + my_file.java. Second is the Show bytecode in the View section in the menu. enter image description here

Both yield different results, so I was looking for more explanation on what those two are.


Solution

  • javac produces bytecode. That's what all JVM languages compile down to.

    IntelliJ's bytecode viewer shows you a projection of that bytecode, since it's normally not human readable.

    Note that the IntelliJ tool won't work if the class is not compiled, since it won't actually know what the exact bytecode is.