aspose file tools*
The moose likes Java in General and the fly likes Need help decompiling version 50 class files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need help decompiling version 50 class files" Watch "Need help decompiling version 50 class files" New topic
Author

Need help decompiling version 50 class files

Thomas Aaron
Greenhorn

Joined: Jan 16, 2008
Posts: 3
I just lost two months worth of coding. It was all written in java 1.6. (No, it wasn't for lack of backing up.) The only thing I was able to save was the jar file from my server.

I've tried a number of decompilers. The best so far is jad. However, it throws the following error:

The class file version is 50.0 (only 45.3, 46.0 and 47.0 are supported)

jad does produce code that I could use to re-create my work, but there are a lot of differences, there are many thousands of lines of code, and I'm incredibly pressed for time.

Has anyone out there had any luck with compiling version 50 class files.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42609
    
  65
Welcome to JavaRanch.

Neither jad nor JODE (on SourceForge) have not been updated to deal with the features introduced in Java 5 (e.g. generics), so that the code they produce will be a good deal different from the original source in any case.

JODE is open source, so that it can be enhanced to produce better output, but it's not a fun or easy proposition.

You may have better luck using a commercial offering, although the comparion on that site suggests that JODE is the best to begin with.
[ January 16, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Thomas Aaron
Greenhorn

Joined: Jan 16, 2008
Posts: 3
Thank you. The SourceAgain commercial compiler kind of looks promising. I've got an email into their support link to see if it supports verion 50 class files. By the description, though, it looks like it may not.

I somehow missed Joda, though, and I'll give that a try as well.
Emmanuel Dupuy
Greenhorn

Joined: Feb 16, 2008
Posts: 4
Hello Thomas,

Do you know JD-GUI? It is a new free Java decompiler. It is currently under development, but maybe it can help you.

Regards.
[ February 16, 2008: Message edited by: Emmanuel Dupuy ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42609
    
  65
Emmanuel, welcome to JavaRanch.

This looks promising, as it's not based on jad or JODE, and more up-to-date than either. Of course, I gotta ask right away -since you mention the cross-platform nature of wxWidgets- might an OS X version be in the future? If that's beyond what you can (or are willing to) do, would you consider enabling someone else to provide a Mac port?
Emmanuel Dupuy
Greenhorn

Joined: Feb 16, 2008
Posts: 4
Hello Ulf. Thanks for your welcome.

I am currently compiling JD-GUI on my Mac mini ... A file "DMG" will be available in the coming days on http://java.decompiler.free.fr
Thomas Aaron
Greenhorn

Joined: Jan 16, 2008
Posts: 3
Thank you.

Unfortunately, I've already re-built the application using output from JAD. I wish I would've known about that application earlier, though. I'll definitely keep it in mind for the future.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14347
    
  22

Note that there's a tool included with the JDK called javap which can disassemble and decompile class files, although it might not be able to completely reconstruct the Java code.

Note that due to type erasure, you most likely will not be able to recover the exact source code if yiou used generics - because the information about the generics usage was thrown away by the compiler.
[ February 19, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42609
    
  65
Originally posted by Jesper Young:
Note that there's a tool included with the JDK called javap which can disassemble and decompile class files, although it might not be able to completely reconstruct the Java code.

Unless something changed in Java 6, javap will only emit bytecode, not Java source code. While its output may be useful for someone who has a passing knowledge of bytecode, it can't be fed to a Java compiler. So javap is really just a disassembler, not a decompiler.
Emmanuel Dupuy
Greenhorn

Joined: Feb 16, 2008
Posts: 4
Exact Ulf. javap emit bytecode only. Once you have the bytecode, there is a long process of reconstruction of instructions 'if ' and statements 'try-catch' and 'synchronize'.
 
Don't get me started about those stupid light bulbs.
 
subject: Need help decompiling version 50 class files