I created a multi-layered licensing and anti-piracy scheme.
This would include license logic based on system hardward, obfuscating and jar hash value validation.
With this said, I would like to protect the case in where the savy java programmer overrides one of the obfuscated license classes. Is there a way to ensure that the class is being used from the jar and not somewhere else (i.e adding an additional class or jar to the classpath).
i.e. obfuscatedclassname.getClass().getName --- ensure that one is being used in the jar.
The Sun Java Tutorial�s section on JAR files includes information on sealing packages, so classes from a package cannot be loaded from a different jar file; and on cryptographically signing jars to verify that they haven't been modified. If you make the appropriate classes final and sign and seal the jars, you can make things harder.
You should be looking at only running with a security manager enabled to enforce these rules.
Just look into java boot classes... its pretty hard to support any type of truly secure scheme of class infection. You may want to integrate with JNI and class hashes, jar signing and the such, but ultimately, its an up hill battle.