I want to create a exe file for my java project but the problem is that anyone can get my application code from exe. Is there any way so that no one can get source code of application from exe file ?
-
3have you read about `byte code obfuscation`? What did you learn? – vikingsteve Sep 10 '13 at 06:20
-
you can't create .exe of your java application. It is compiled to .class format which is then iterpreted by java virtual machine. – mawia Sep 10 '13 at 06:21
-
1"so no one can find ource code from exe" well just because it is an exe file, people can still decompile it and find the source code. Basically you can never totally HIDE it. Your best choice is to hide it as good as you can, and then obscure your source code, so it will become very hard to understand and see any structure in it. – vallentin Sep 10 '13 at 06:21
-
to Learn about obfuscation please [read this small article](http://viralpatel.net/blogs/protect-java-code-decompilation-using-java-obfuscator/) – The PowerHouse Sep 10 '13 at 06:22
-
see this thread http://stackoverflow.com/questions/2011664/compiling-a-java-program-into-an-exe – krishnakumarp Sep 10 '13 at 06:27
-
@javaBeginner Yes, yes we can, within a couple of seconds... – vallentin Sep 10 '13 at 06:29
-
There are many desktop applications made in java available in market from which we can't get the .class files.How they are doing it? – Rajan Garg Sep 10 '13 at 06:30
-
@javaBeginner Just download any working "Java Decompile" and with that, you will be able to open .jar and .class files, and it will straight out give you the source code. – vallentin Sep 10 '13 at 06:31
-
@javaBeginner just download any good decompiler and open the class file with it.I would suggest JAD – The PowerHouse Sep 10 '13 at 06:31
-
@RajanGarg could you give a link to one of those programs, so I can see for myself? – vallentin Sep 10 '13 at 06:34
-
I'd drop "Java" somewhere within the text of your question. – Dmitry Leskov Sep 12 '13 at 08:20
2 Answers
You can create an exe with an application such as Excelsior Jet, (as I have in the past) or another freeware (or payable software if you want to invest in it) from the internet. The problem with excelsior jet is that if you want it for free, you will only get a 90 day trial period, and all created exes stop working after the trial has ended. Exes are not crack proof, however they do make getting to the source code a bit tougher. The other bonus of creating an exe is that the final user will not be so dependent on Java to be installed in their computer.

- 326
- 7
- 17
-
-
I get the question is a bit vague, but at least I am actually trying to give this dude a reasonable choice of a freeware that might do what he needs. I do not encourage anyone to violate any evaluation license, just pointing out that if the problem requires a solution that will still be working after 90 days, the link I provided may not constitute as a best choice. There are more totally free exe creators out there that can do what he is asking for. I only brought up excelsior jet since it has a friendly GUI for new programmers and it provides a free trial to see if it meets quota. – ghoulfolk Sep 10 '13 at 06:45
-
1There is also a very good article on the Excelsior website: [Convert Java to EXE Why, When, When Not and How](http://www.excelsior-usa.com/articles/java-to-exe.html) – splash Sep 10 '13 at 07:13
-
Does anyone have idea how Excelsior Jet makes exe in a way so that to find source code is not a easy job? – Rajan Garg Sep 10 '13 at 07:18
-
2well, you can try to study this from excelsiors webpages, such as here: (http://www.excelsior-usa.com/jetinternals.html) where they have written: "The best way to secure your Java classes against reverse engineering is to not distribute them at all. Ahead-Of-Time compilation makes it possible." – ghoulfolk Sep 10 '13 at 10:46
-
You can use Excelsior JET for free without violating the license, if your project is non-commercial: http://www.excelsior-usa.com/jetfree.html – Dmitry Leskov Sep 12 '13 at 08:13
-
@ghoulfolk With the exception of GCJ, those "totally free exe creators" are just [wrappers](http://www.excelsior-usa.com/articles/java-to-exe.html#launch) for your class files. – Dmitry Leskov Sep 12 '13 at 08:19
-
@Dmitry Leskov I am aware that you can apply for a non-commercial version of the excelsior jet. I have done this in the past (approx. 1 year ago), and am yet to receive a reply from the excelsior team :) I am guessing that free give-aways are not a very high priority for them, or then they just don't want to give me the free license.. maybe my arguments for a free license did not match their own definition.. – ghoulfolk Sep 13 '13 at 12:46
-
@ghoulfolk Sorry about that. Public email services sometimes classify our responses as spam, so I suggest you email us again and then watch your Junk Mail folder. Also, we had a [charity program](http://www.excelsior-usa.com/jetcharity.html) running at about that time, during which we did not issue free Standard Edition licenses. – Dmitry Leskov Sep 14 '13 at 04:25
Is there any way so that no one can get source code of application from exe file ?
No.
And a short elaboration (to what I expect the author asked): Java classes are compiled to bytecode to be executed by a JVM. As JVMs were primarily designed to be implemented by software, the JVM instruction set contains certain high-level operations, such as object creation, method invocation etc. that allow 1:1 mapping to high-level operations in the source code. This, along with the fact that the JVM instruction set is very-well documented, is one of primary reasons why it is so easy to reconstruct the Java source code.
And a short elaboration (to what was asked):
Creating a platform-targeting executable out of a Java class is not a trivial task. One of the reasons might be the fact that the whole Java standard library (including essential java.lang
classes) is implemented in Java.
Assuming that you have solved that issue, most probably by providing a subset of the standard library classes implemented natively, the resulting assembler code can still be reverse-engineered back into the source code. It is possible to track down class/object/method boundaries and work your way up from there. Of course, the resulting source may not be nearly as readable/comprehensible.

- 1,955
- 19
- 33
-
-
'Assuming that you have solved that issue' refers to Excelsior JET, that you are supposedly advertising. 'It is possible to track down class/object/method boundaries' is about platform-native code. Especially since E JET will embed (part(s)) its own Java library implementation in the resulting executable. – Tadas S Sep 12 '13 at 11:58
-
1Inline substitution leaves no boundaries. But there is also [hardware encryption](http://www.excelsior-usa.com/blog/excelsior-jet/java-bytecode-encryption-revisited/) - good luck getting the source code back from that. – Dmitry Leskov Sep 13 '13 at 09:58
-
I am just getting the facts straight. A downvoted question is not a good place for advertisement, is it? – Dmitry Leskov Sep 13 '13 at 10:03
-
@DmitryLeskov: good point. By the way, from what I see E JET is still dominating the market, so no real advertising either way. +1 for the link about hardware encryption. – Tadas S Sep 13 '13 at 14:43