문제

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)?

도움이 되었습니까?

해결책

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:

  • Try converting it into a native executable (there are a few tools to do that)
  • Run an obfuscator over it (there's even more tools for that)

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.

다른 팁

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.

Did you try Export>Java>Runnable JAR file option in Eclipse?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top