7

How to get java file i.e source code from class file i.e from compiled file?

n002213f
  • 7,805
  • 13
  • 69
  • 105
giri
  • 26,773
  • 63
  • 143
  • 176
  • Check this link : http://java.decompiler.free.fr/ Another one : http://www.varaneckas.com/jad – Zaje Dec 31 '09 at 08:41

6 Answers6

5

Check out this Java Decompiler.

Also see this Wikipedia page to know more about decompilation.

It should be noted that the code you get on decompilation of bytecode isn't very readable.

missingfaktor
  • 90,905
  • 62
  • 285
  • 365
2

You have to use a disassembler.

Java Decompiler is a good choice.

Also Java Decompiler has a plug-in for Eclipse.

Upul Bandara
  • 5,973
  • 4
  • 37
  • 60
1

You can use javap command to get the overall structure of the file.

On the side note: Best way to disable anyone from getting the source from your compiled code is to use obfuscation.

bschandramohan
  • 1,968
  • 5
  • 27
  • 52
0

I just published a stand-alone Java Decompiler GUI (based on Jad) which you can get from Util Java Decompiler (JAD based) v1.0

This is a Windows based .NET 4.0 application, which supports the drag n'drop of *.jar files.

Dinis Cruz
  • 4,161
  • 2
  • 31
  • 49
0

You can make use of javap for getting the source back from bytecode.

There are plenty of tools and plugin that help you to disassemble and you can find some discussed here.

Community
  • 1
  • 1
codaddict
  • 445,704
  • 82
  • 492
  • 529
0

Yes you cannot do anything like reverse conversion.

What you can do is modify the bytecode at runtime. That's allowed in Java...

Check for java.lang.instrumentation package. That will help you to achieve your goal to some extent...

Florent
  • 12,310
  • 10
  • 49
  • 58
Mahesh Gupta
  • 2,688
  • 9
  • 30
  • 46