How can i execute second command from java to remote machine if the first one is still active?


I have remote connection to Linux machine and i am giving commands through java application but for e.g. if i run npm start and then i would like to kill the process or execute another command in the same connection it gives me this exception: A remote execution has already started.

What should i do? Can someone help me with this? Thanks in advance.