X Tutup
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Ron McLeod
Saloon Keepers:
  • Tim Holloway
Bartenders:

Converting class code back to source code

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help! I ran a program and redirected the output to a flat file, but I named that file the same as the program name. So I overwrote my program, Selection.java, with the text of the output by saying java Selection > selection.java. Anyone know the DOS command to convert the .class file back to the .java file?
EDIT: I'll try to find a decompiler at downloads.com. Isn't javap supposed to do this? It does something, but it doesn't create the .java file when I run it in \bin.
Thanks,
Doug
[ November 18, 2002: Message edited by: Doug Wolfinger ]
[ November 18, 2002: Message edited by: Doug Wolfinger ]
 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try a google search for "java decompiler".
I've used DJ before
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javap is not a decompiler.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mocha
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just downloaded and used mocha.
it is a basic tool.
it is a very cool tool.
i wish i had it a few year ago.

what i did to get mocha to work
1. downloaded mocha.zip
2. copied mocha.zip to c:\jdk1.3.1\lib
3. add c:\jdk1.3.1\lib\mocha.zip to my CLASSPATH
CLASSPATH=.;c:\jdk1.3.1\lib\mocha.zip
4. from a dos prompt i typed
java mocha.Decompiler -v -o test63.class
*. a text file called test63.mocha is created
that's it...
[ November 20, 2002: Message edited by: Monty Ireland ]
 
Doug Wolfinger
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, all. I have a beta Mocha installed but can't get it to work, so I used DJ. The decompilation was very pleasant but I noticed some disturbing things afterwards. For one thing, I couldn't get into my c:\ where the executable was located after the decompilation. It was alarming. The software locked up the c:\ somehow. So I closed Win Explorer and everything was fine when I reopened it. And I noticed that all class files had the DJ icon. I decided to get rid of it, and deleted the DJ files that made all the class files associate with it.
I didn't realize the source code would be neatly formatted by the decompiler, so that was a nice surprise.
If the new version of Mocha works I might go with that; it operates from the dos command line, so it should be less obtrusive.
[ November 19, 2002: Message edited by: Doug Wolfinger ]
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try to find "jad" java decompiler
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Igor Ko:
try to find "jad" java decompiler


Jad's great -- very easy to use,
http://kpdus.tripod.com/jad.html
install it, put it in your %PATH% and call jad someClass.class and *poof* it write a someClass.jad for you. -- Just make sure you check out the known limitations of the product and realize you'll lose all comments from the code.
 
reply
    Bookmark Topic Watch Topic
  • New Topic
X Tutup