• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Java file from .class file ?

 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks.
 
Vinayak Kulkarni
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using any Java de-compiler you can get java file from its class file
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jad (google for it) and Jode (on SourceForge) are quite good.
 
Adam Richards
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • 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.
 
Amit K Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mind that the same is valid for any code, written in any language, for any platform.
 
Tomas Anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • 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.
 
Raghavendra nandavar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • 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.
 
Casper Maxwell
Ranch Hand
Posts: 88
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic