title: Java process always return -1
body: <p>I am trying to use C library(CFM-ID) from my java program. There are executable files in bin folder of C project.
  When I run C project from terminal, its working. </p>
  
  <pre><code>cd /home/lclab/cfm-svn/cfm/bin
  ./fraggraph-gen CC 2 + fullgraph
  </code></pre>
  
  <p>fraggraph-gen is the executable file. Then I tried it with my java program</p>
  
  <pre><code>Runtime rt = Runtime.getRuntime();
  String command = "/home/lclab/cfm-svn/cfm/bin/fraggraph-gen CC 2 + fullgraph";
  Process pr= rt.exec(command);
  InputStream in = pr.getInputStream();
  System.out.println(in.read());
  </code></pre>
  
  <p>But it always return -1.
  then I've created C program and implemented executable file.</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
  
  int main( int argc, char *argv[] )  {
  
     if( argc == 2 ) {
        printf("The argument supplied is %s\n", argv[1]);
     }
     else if( argc &gt; 2 ) {
        printf("Too many arguments supplied.\n");
     }
     else {
        printf("One argument expected.\n");
     }
  }
  </code></pre>
  
  <p>And executed it by my Java program by changing the command variable.</p>
  
  <pre><code>String command = "/home/lclab/Desktop/jni/test param1";
  </code></pre>
  
  <p>Its working. Please be kind to give me a solution for this issue. Thanks</p>