How can I open Java .class files in a human-readable way?
I'm attempting to identify what a Java applet is class documents is doing under the hood. Opening it up with Notepad or Textpad simply reveals a number of gobbledy - gook.
Exists any kind of means to wrangle it back right into a rather - legible layout so I can attempt to identify what it is doing?
- Setting = = Windows w/ VS 2008 mounted
If the class documents you intend to check into is open resource, you need to not decompile it, yet rather attach the resource files straight right into your IDE. in this way, you can simply watch the code of some collection class as if it were your very own
There is no demand to decompile Applet.class. The general public Java API courses sourcecode features the JDK (if you pick to install it), and also is much better legible than decompiled bytecode. You can find pressed in src.zip (situated in your JDK installment folder).
You require to make use of a decompiler. Others have actually recommended JAD, there are various other alternatives, JAD is the most effective.
I'll resemble the remarks that you might shed a little bit contrasted to the initial resource code. It is mosting likely to look specifically amusing if the code made use of generics, as a result of erasure.
JAD and/or JADclipse Eclipse plugin, without a doubt.
That is assembled code, you'll require to make use of a decompiler like JAD: http://www.kpdus.com/jad.html
You desire a java decompiler, you can make use of the command line device javap
to do this. Additionally, Java Decompiler HOW-TO defines just how you can decompile a class documents.
what you are seeking is a java de - compiler. I advise JAD http://www.kpdus.com/jad.html It is free for non business usage and also does the job.
Keep in mind: this isn't mosting likely to make the code specifically the like what was created, ie. you are mosting likely to shed remarks and also perhaps variable names, so it is mosting likely to be a little tougher than simply reviewing regular resource code. If the programmer is actually deceptive they will certainly have obfuscated their code too, making it also harder to read.
As recommended you can make use of JAD to decompile it and also watch the documents. To make it less complicated to read you can make use of the JADclipse plugin for eclipse to incorporate JAD straight to overshadow or make use of DJ Java Decompiler which is a lot easier to make use of than command line JAD
If you do not mind reviewing bytecode, javap needs to function penalty. It becomes part of the typical JDK installation.
Usage: javap <options> <classes>...
where options include:
-c Disassemble the code
-classpath <pathlist> Specify where to find user class files
-extdirs <dirs> Override location of installed extensions
-help Print this usage message
-J<flag> Pass <flag> directly to the runtime system
-l Print line number and local variable tables
-public Show only public classes and members
-protected Show protected/public classes and members
-package Show package/protected/public classes
and members (default)
-private Show all classes and members
-s Print internal type signatures
-bootclasspath <pathlist> Override location of class files loaded
by the bootstrap class loader
-verbose Print stack size, number of locals and args for methods
If verifying, print reasons for failure
JAD is a superb alternative if you desire legible Java code therefore. If you actually intend to explore the internals of the .class
documents layout however, you are mosting likely to desire javap
. It is packed with the JDK and also permits you to "decompile" the hexadecimal bytecode right into legible ASCII. The language it generates is still bytecode (nothing like Java), yet it is rather legible and also exceptionally instructional.
Additionally, if you actually intend to, you can open any kind of .class
documents in a hex editor and also read the bytecode straight. The outcome corresponds making use of javap
.
Using Jad to decompile it is possibly your ideal alternative. Unless the code has actually been obfuscated, it will certainly generate an all right outcome.