Punit Jain wrote:yes, but how do i run that in background that is the question.
how do i do this: compile the program, run the program and exit from cmd, and it starts running in background.
So you're going to do this even though it will probably cause other apps to not work correctly? Are you trying to play a nasty prank on somebody you don't like?
Compiling has nothing to do with it. You compile the way you always would. I don't know why you think that would be any different.
As for running in the background, that has nothing to do with Java. You run java in the background the same way you'd run anything else in the background. In Linux shells you put ab ampersand (&) after the command (and possibly prefix it with nohup). Windows may also use the ampersand, but I'm not sure. You can google for how to run in the background in whatever environment you're in.