title: Execute a curl command in java to a localhost
body: <p>I'm a beginner with all this and I need to execute a docker command without using <code>sudo</code> in ubuntu to use the <code>gcc</code> compiler. 
  In order to make that happen, a friend of mine wrote a script, in go lang, named http-to-shell and that is a program that listens as http server on  <code>http://localhost:4000</code>, and executes commands on terminal and returns output to client as a json response.
  <p>
  I run the command </p>
  
  <pre><code>sudo go run http-to-shell.go 
  </code></pre>
  
  <p>and then on another tab i use commands like </p>
  
  <pre><code>curl -d command=ls http://localhost:4000
  </code></pre>
  
  <p><p> this works perfectly and then if I use </p>
  
  <pre><code>curl --data-urlencode "command@command.txt" http://localhost:4000
  </code></pre>
  
  <p>it runs the docker command that is in <code>command.txt</code> and shows the output of the program on the previous tab where i run <code>sudo</code> go run.
  <p>
  Now, my main issue. Since I'm a beginner I have no idea how to run this from a jsp page from localhost:8080 in ubuntu.</p>
  
  <p><p> I have been trying, I tried using the answer in <a href="https://stackoverflow.com/questions/24053634/using-curl-command-in-java">Using curl command in java</a>
  but the process builder doesn't work. 
  I need to run this curl command and get json response to show the user the output of his code.
  <p>Please help me out here. </p>