• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help decompiling version 50 class files

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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'.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic