Shell script calling non-main method of running java program
<p>I have developed a shell script, which calls main method of a java program <code>RHEL</code> environment.  </p>

<p>Shell script ( say <code>app.sh</code>) have multiple options on the lines of <code>tomcat.sh</code> </p>

<p><code>start:</code> It will start a java program by calling main method</p>

<p><code>stop:</code> It will get running process id and kill the process </p>

<p>I have already implemented <code>start</code> and <code>stop</code> command and looking forward to implement pause command. </p>

<p><code>pause:</code> <strong><em>This option should get the pid of running java application and call a non-Main method</em></strong>.</p>

<p>I don't have issues to get the process id. <strong><em>But can I invoke non-Main method of java program from running process id?</em></strong></p>

<p><strong>EDIT:</strong> </p>

<p><a href="https://stackoverflow.com/questions/368802/how-can-i-call-a-method-in-an-object-from-outside-the-jvm">How can I call a method in an object from outside the JVM?</a> question offer solutions in different technologies but I can't move to different technology except using shell script. </p>