• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help decompiling version 50 class files

 
Thomas Aaron
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Thomas Aaron
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic