• 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

How to get Java file from .class file ?

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How can we get source Java code from the compiled .class file ?

Thanks.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using any Java de-compiler you can get java file from its class file
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jad (google for it) and Jode (on SourceForge) are quite good.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But don't assume you'll be able to understand it very well, since comments, design philosophy, etc. will be absent.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any option(s) available through which I can prohibit my class from getting decompiled?

--Amit Srivastava
 
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
You can make it progressively harder, but a technically sophisticated user will always be able to recover the bytecodes, and run that through a decompiler.

If you can require the user to be online, it may be feasible to have the application call a servlet, and execute crucial code on the server, and then send the results back to the application.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mind that the same is valid for any code, written in any language, for any platform.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't want your users to have to connect to a servlet (ie - you want an application or an applet), you can obfuscate your code.

Obfuscation is the practice of making your Java code so complicated and confusing that nobody can tell what's happening. A good obfuscator makes your code ridiculously complex while not sacrificing too much speed. You would usually use download a program to obfuscate your code for you, and keep separate versions of the code - one for development and an obfuscated version.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We use a product that logs things like Exception A thrown by a.a.a.b.c.d.X o()

I've never felt the least urge to decompile it.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ja vardhan:
Hi,

How can we get source Java code from the compiled .class file ?

Thanks.



You can use the Java DJ Decompiler to get the source file
from the class file.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These two list may help you:

http://www.java-tips.org/java-applications/obfuscator/
http://www.java-tips.org/java-applications/java-decompiler/
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic