title: Elasticsearch REST api through curl not working from java.runtime.exec
body: <p>I have a java app in which I'm just reading a file and inserting the data into the elasticsearch index.</p>
  
  <p>Here is the code I 'm using.</p>
  
  <pre><code>        in = new BufferedReader(new FileReader("file.txt"));
          line = in.readLine();
          while ((line = in.readLine()) != null) {
              System.out.println("Command: curl -XPOST 'http://localhost:9200/esensor/data' -d '{ \"temp\": \""+line+"\" }'");
              p = Runtime.getRuntime().exec("curl -XPOST 'http://localhost:9200/esensor/data' -d '{ \"temp\": \""+line+"\" }'");
              p.waitFor();
  
              BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
              while ((line = err.readLine()) != null) {
                   System.out.println(line);
              }
              break;
          }
          in.close();
  </code></pre>
  
  <p>But this is not working. Curl is giving this error.</p>
  
  <pre><code>curl: (1) Protocol 'http not supported or disabled in libcurl
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: "temp"
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: "17.35757"
  curl: (3) [globbing] unmatched close brace/bracket in column 1
  </code></pre>
  
  <p>But see I have printed the command which I'm executing. If I manually copy paste that in console then everything working fine. Why it is happening? What I'm doing wrong? </p>