how to lock a keyboard using java code

Unplug the keyboard.
Or write the impossible virus.

Not sure what you want to know...
Locking, aka, disabling input?
Input to the entire system?
I dunno if Java can do that.

Maybe if there's a panel that retains focus and absorbs all key events.. But probably not.

Two things:

A) You kinda need to show some effort before the Java gurus and the other people who know Java (including myself) will help you
B) This wouldn't happen in Java. You can just close the Java VM if you want to close the program.

and no, it's NOT urgent.
And we don't know what "ecery" means.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.