I want to prevent the user from running my java application multiple times in parallel.
To prevent this, I have created a lock file when am opening the application,
You can write something like this.
If file exists try to delete it. if it is not able to delete. We can say that application is already running.
Now create the same file again and redirect the sysout and syserr.
This works for me