I'm founder of the company that makes LimeLM, a licensing and online activation product. We have examples showing how to use LimeLM & TurboActivate with Java. Also, if you want to prevent your compiled jar from being decompiled we recommend using ProGuard in tandem with LimeLM. ProGuard is a free and open source obfuscator for Java.
If you have any questions we'll be glad to give you a hand.
Tell me if this helps.
What's the use of copy protection?
This point was raised in another answer, so I'll address it here. Every copy protection can be cracked. This is an indisputable fact. So that raises the question: what's the point of copy protection if it can be cracked?
Here's the answer: casual piracy.
Customers using the same product key over and over again (aka casual piracy) can cost you real money. It's rarely malicious -- these customers aren't wringing their hands while giving their best evil villain laugh. It's much more banal. It's usually the department in a company that buys the licenses is different than the department in the company that actually handles the licenses.
This is why you need strong hardware locked licensing. It will tell your customers when they've used their allotted licenses so they can purchase more. Then they can purchase more licenses and be merrily on their way.
The Business Software Alliance does a yearly study on casual piracy -- check out their studies if you need further proof.
But what about crackers?
If it exists on a computer it can be cracked. You can't stop crackers. All you can do is increase your revenue by dealing with casual piracy.