How to prevent class files from being decompiled

The class files can be easily decompiled by various java decompilers. Is there anyway to seal or prevent class files from being decompiled.

[146 byte] By [prabh13a] at [2007-11-27 11:39:39]
# 1

no

ejpa at 2007-7-29 17:27:25 > top of Java-index,Developer Tools,Java Compiler...
# 2

yes, don't distribute them.

Same as anything else, once the bad guys get their hands on it it's game over, so the only defense is to make sure they never get it in the first place.

jwentinga at 2007-7-29 17:27:25 > top of Java-index,Developer Tools,Java Compiler...
# 3

I often wonder what they can do with it, without the comments,

I sometimes cannot comprehend my own programming :o)

NovaLokaa at 2007-7-29 17:27:25 > top of Java-index,Developer Tools,Java Compiler...
# 4

Well exactly. I did some reverse-engineering about 25 years ago. It is rarely economic.

And if the OP is trying to protect some security feature he's about 50 years out of date - all the best security mechanisms are publicly known.

ejpa at 2007-7-29 17:27:25 > top of Java-index,Developer Tools,Java Compiler...