Reputation: 4141
My project isn't complete, but I'd like to distribute some demo versions.
Is there a way to make a executable JAR file that won't give users access to its classes (e.g. when imported into Eclipse)?
Upvotes: 1
Views: 99
Reputation: 6509
No, a jar file is a zip file and there's no way to stop your users from looking inside it - because the JVM needs to look inside it to run it.
You can however:
My experience with obfuscators are that they don't do a good enough job to acutally stop someone who's really keen. I've tried running decompilers over a variety of obfuscated classes and they're still easy enough to understand.
If you're interested in the native exe path, then this article might help.
Generally speaking, I don't think it's worth pursuing. If what you're distributing it valuable enough to the people you're giving it to, then they'll find a way to dig inside if they want to. Or if they're trustworthy then they won't. But technological solutions probably won't change that.
Upvotes: 2
Reputation: 160181
Your only hopes lie through obfuscation or encryption. Neither is all that awesome in terms of protection against a determined poker-arounder. You sure it's worth it?
ProGuard is a free obfuscator (among other things). Encryptors use custom classloaders to decrypt encrypted byte code on loading.
Upvotes: 2