This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java Decompiler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Decompiler" Watch "Java Decompiler" New topic
Author

Java Decompiler

Shiraz Khan
Ranch Hand

Joined: Mar 20, 2006
Posts: 51
I have learned about decompilers which give you source code from the .class file. Isn't this something which violates the basic right of a developer ?
Anybody can decompile and get the source code ..
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

They sure can. If you do that to copy righted code you might find yourself in jail


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
rohit leeta
Ranch Hand

Joined: May 02, 2007
Posts: 49
They are useful when you lost source code of some application/library you wrote and need the source code. Other than that usage of it can be illegal.


<a href="http://www.java-forums.org" target="_blank" rel="nofollow">Java Forums</a>
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
You can try Obfuscating your code before you hand over to client.


Rahul Bhattacharjee
LinkedIn - Blog
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Originally posted by Shiraz Khan:
Isn't this something which violates the basic right of a developer ?


I find this problem interesting, because I have to deal with several issues - on large projects - which can be fun and challenging for some of the advanced workers I see in this Java Ranch discussion group, but what are the basic rights of a developer ? Yes, you most definitely have a right to protect your proper efforts from unjust use - but what of the many workers who give away code for free ? In paticular, the Sun website has thousands of keystrokes of code which is Copyright 1994-1998 by Sun Microsystems, Inc., which you may use.

The sad part about it is that there is no short supply of ( ? ) which will try to take something which is protected, going past better things that are given away free.



But I have a team memeber who is degreed in such matters and have been advised that most businesses do not have time nor patience to deal with such things and will impede the project if I try to code around such work.

Then lines 88-101 of my work go to great lengths to detect unauthorized use:

class files can be de-compiled, but I suggest dealing with reasonable people / do what you can about it / consider it in your work ....

But be moderated in your solutions.
Shiraz Khan
Ranch Hand

Joined: Mar 20, 2006
Posts: 51
Is there any other language where similar thing is possible ?
And it this a limitation of Java that its source can be extracted from binaries ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2504
    
    8

I would like to know why you want to hide your code.
Would it bring your company harm if someone succeeded in reading your code?
If they did, could they than commercialize it and steal a part of your business revenue?

(I am asking this because it does not seem to worry the companies that distribute their code as unobfuscated jars)

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Proper licensing , copy righted code is a good solution.
[ May 07, 2007: Message edited by: Rahul Bhattacharjee ]
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Originally posted by Shiraz Khan:
Is there any other language where similar thing is possible ?

There is a language which forces one to document the source code in the distributed executable, or the program will not compile. I do not remember the name of it.
And it this a limitation of Java that its source can be extracted from binaries ?

Well, actually, they are not totally binaries. The format is what is called a Web Archive, and is not dissimilar to a Zip file. The binary information in the file is largely limited to tracking offsets of where bytecodes are - bytecodes are a common form of intermediate description of program functioning that can be readily translated to runnable / executable instructions on a machine.

Here is an example:




No one would object if you use Java for learning, then write in some other language, but by the time you get your question answered ~ you won't be going to another language.'


[ May 13, 2007: Message edited by: Nicholas Jordan ]
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Originally posted by Jan Cumps:
(I am asking this because it does not seem to worry the companies that distribute their code as unobfuscated jars)


Yup, me too. I went round and round on this untill I began obfusicating func()'s by naming them from random natural events - to avoid one avenue of enroachment. Then on the other hand, some companies have some things that need to be protected. It may do the poster some good to consider that encryption Algorithm - widely used in computing, linguistics, and related disciplines, does not need to be protected - only the keys.

Additonally, D.E.K. Vol II § 3.1 Algorithm K:
Super Random number generator
Given a ten digit decimal number X, this algorithm may be used to change X to number that shoulld come next in a suposedly random sequence. Although the algorithm might be expected to yield quite a random sequence, reasons given below show that it is not, in fact, very good at all. (The reader need not study this algorithm in great detail, except to observe how complicated it is; note, in paticular, steps K1 and K2)


That's Donald E. Knuth.     
[ May 13, 2007: Message edited by: Nicholas Jordan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Decompiler