0

I use Class.forName("classname") to get a Class object, I want to convert to Class object to String, which means decompile the java file, and show this string to GUI.

How can I do? Thanks

JerryCai
  • 1,663
  • 4
  • 21
  • 36

1 Answers1

4

Java won't decompile classes for you - you need a separate decompiler for that. Try this one, which was suggested by this answer.

Community
  • 1
  • 1
Aasmund Eldhuset
  • 37,289
  • 4
  • 68
  • 81
  • thanks for your tool, I know there are many stand-alone tools for decompiling. I was wondering is there exists a jar or something I can use in my program to decompile the class? – JerryCai Jun 13 '12 at 09:24
  • @JerryCai: To my knowledge, the standard Java API doesn't provide anything like that; however, there may be third-party libraries for decompilation. – Aasmund Eldhuset Jun 13 '12 at 10:24