esuslogo
 [To advertise Java(tm) Events here, contact us!]
banner

Java™
by example!






New @ Esus.com


  gb  In-house search engine for better results!

  gb  Get updates with the esus.com
newsletter!









  Home 
 Browse Categories 
 Ask a Java Question 
 Help 
  For Java Tips & Tricks, subscribe to the esus.com newsletter!
Search Java Q&A, Links, API's:   adv 

How do I decompile JDK 1.5 classes?

jad expects class file versions (major.minor) to be 45.3 or 46.0. Sources compiled with 1.5 have the file version 48.0. The following error message is displayed when trying to decompile a 1.5 .class file:

 
This code sample is only viewable to esus.com members
Login or become a member!


To be able to use JAD, we can simply change the class file version of a 1.5 compiled class into 46. The following small application sets the magic number of a .class file or all classes in a jar file to whatever you desire.

ChangeMagicNumber.java:

This code sample is only viewable to esus.com members
Login or become a member!


For example:

 
This code sample is only viewable to esus.com members
Login or become a member!


Now the decompilation of the following 1.5 enum-example source works fine, after changing its file class version to 46.

Main.java:

This code sample is only viewable to esus.com members
Login or become a member!


Execute:

 
This code sample is only viewable to esus.com members
Login or become a member!


results in:

DestinationType.jad:

This code sample is only viewable to esus.com members
Login or become a member!




Further Information
Author of answer: Joris Van den Bogaert

Comments to this answer are only viewable by members. Login or become a member!





Terms of Service | Privacy Policy | Contact

Copyright © 2000-2003 Esus.com - All Rights Reserved 
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. Esus.com is independent of Sun Microsystems, Inc. All other trademarks are the sole property of their respective owners.