title: Calling Compiled C++ exe file from java not working
body: <p>I am trying to call a C++ program from java and my C++ program as follows:</p>
  
  <pre><code>// A hello world program in C++
  // hello.cpp
  
      #include&lt;iostream&gt;
      using namespace std;
  
      int main()
      {
          cout &lt;&lt; "Hello World!";
          return 0;
      }
  </code></pre>
  
  <p>What I did was I am using <code>minGW compiler</code>  for compiling C++ program to hello.exe and when I working it, it is working:</p>
  
  <pre><code>C:\Users\admin\Desktop&gt;g++ -o hello hello.cpp
  
  C:\Users\admin\Desktop&gt;hello.exe
  Hello World!
  </code></pre>
  
  <p>I have created a java program in such a way that it should call the C++compiled program(hello.exe), but my java program is note calling the exe, my program as follows:</p>
  
  <pre><code>//Hello.java
  
  public class Hello {
      public static void main(String []args) {
  
          String filePath = "hello.exe";
          try {
  
              Process p = Runtime.getRuntime().exec(filePath);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  } 
  </code></pre>
  
  <p>Check the output of java program:</p>
  
  <pre><code>C:\Users\admin\Desktop&gt;javac Hello.java
  
  C:\Users\admin\Desktop&gt;java Hello
  
  C:\Users\admin\Desktop&gt;
  </code></pre>
  
  <p>Why it is not working, Please help me?</p>