Reverse Engineering is some thing which i really wanted to do. It was just out of curiousity i tried it some time back when i was in my UG. Now it was a requirement for my project so i had to reverse Engineer a code ie convert the .class file to .java file.
I used Mocha written by Hanpeter van Vliet , One of the most used tool ,to reverse Engineer in Java. It has around 200+ classes in a .zip file. There is no need to unzip the “mocha.zip” file contained in the distribution zip file; Java knows how to get .class files out of zip files. Simply put “mocha.zip” in a safe place, for instance the JDK directory. Add the full pathname of “mocha.zip” to your CLASSPATH string, for instance:
SET CLASSPATH=c:\myclasses;c:\jdk\mocha.zip
Now the next question would be to invoke it.
Mocha is invoked from the commandline like this:
java mocha.Decompiler [-v] [-o] Class1.class Class2.class …
Where
“java” invokes the Java virtual machine,
“mocha.Decompiler” (note the case!) specifies the class to run,
“-v” optionally specifies verbose output,
“-o” optionally overwrites existing .mocha files,
“ClassX.class” specifies the .class file(s) to decompile.
Wildcards (* and ?) are accepted.
Cool you just did a great Job of converting a compiled .class file back to your .java file
cheers!!
No cooments sir
why must move blog from spaces.blogspot?
older blog was nice sir
Wudnt it be illegal to reverse engineer code ?!! especially if the original code aint yours !
pls clarify !
@Abhinav
You hit a nail on the Head.. Offcoz its illegal to reverse Engineer for commercial purpose , that too when its not your code. It is what you call as “INTELLECTUAL PLAGIARISM” having said that it doesnt mean that you shouldnt reverse Engineer to learn things. And My post is more of for latter purpose then the former.
Hi! I have tagged you and you need to respond to it with a blog post.
Check – http://suniljagadish.blogspot.com/2006/03/tagged-twice.html
hey ranga, i came to blore for the academic days event and came to know abt u frm sharath. And even found out that u r a java freak (dats nice) cos even im one ;).
About reverse engg. a java class file try this tool http://www.download.com/DJ-Java-Decompiler/3000-2417_4-10439692.html
keep in touch! Bye!
Reverse Engineering ???? I guess i hv a long way to go … yes i do remember u … we first met @ christ college fest – 04 right … later @ magnetics .. hows dipanjan doing ?
@ Hey Ashwin nice to meet you man! Great that you travelled all the way from Chennai to Bangalore to Attend the Academic Days. Ya i do love Java and now learning C# as well.
@ Great to see that you remember dude.. Hows life? N when is Magnetics 06?
Magnetics 06 is on 13th and 14th of this month … juniors organizing this time … i guess u must hv completed ur MCA by now ? … ICFAI right
hey dude no man we are still in Final Year.. We will finish our MCA by this August.. anyways do give details about Magnetics man.. probably we can drop in..
sorry for the delay in response … we hv dispached an invitation @ ur college as on 10th … take a look @ http://theoxford.edu/magnetics for event related info …. registration is on spot
Hello, I am trying to reverse some .class files with jcavaj. But i am getting 1st cannot be parsed and after giving ok i able to view the code. But is not running.can you guide me