How can i develop a keylogger using java??

The problem is that we should only implement KeyListener interface to a window or
but how can we make use of KeyListener event without windows of frame????

you need to directly access the systems event queue, opposite to what the Robot class does.
for this to work, your keylogger must scan each event before the default system event handling gets to it.

can u give me the code for keylogger???

commented: No, this is Code On Demand. -3

unfortunately no, I have a similar problem my self, I was simply offering another way to approach the problem

Why do you need a keylogger?