title: How do I run a java class with arguments from a JSP page?
body: <p>I have previously written a java class that was executed from a bash file, now I need to allow its execution from a JSP page using a Javascript/HTML button, I wonder how do I do that? </p>
  
  <p>First, my class looks like this:</p>
  
  <pre><code> public class Sync
   {
     public static void main(String[] args)
     {
     //my content here
     }
   }
  </code></pre>
  
  <p>This Sync class has been run from a bash script as follows:</p>
  
  <pre><code>cd /root/tomcat/webapps/project/WEB-INF/classes/
  echo "Executing first part..."
  /usr/local/java/bin/java classes/CLRSyncCLI 120.0.0.1 up false Y ${IPS[@]}
  echo "Executing second part..."
  /usr/local/java/bin/java classes/CLRSyncCLI 127.0.0.1 down false Y ${IPS[@]}
  </code></pre>
  
  <p>note that:classes is the directory where all compiled java classes are within the TomCat web server.</p>
  
  <p>now within jsp page I need something like:</p>
  
  <pre><code>&lt;input type="button" value="Execute" name="to" action="run" onClick="path here"&gt;
  </code></pre>
  
  <p>How do I run this sync classes with its arguments twice from a single button click, and display that the class has been executed with a message.</p>