jps which lists only java processes will not work. However jconsole -p
However there are cases when you are not able to connect to the console session. In that case enabling interaction with console option will not help but you can still communicate with files.
Just write a batch file and execute it with cmd.exe -C
you can redirect your input and output to files so you will be still able to communicate with the shell