Am trying to run the source code from this link
Compile and run source code from Java application
I installed the Mingw32 compiler changed the compiler location path and getting this error when running a sample .cpp file in Eclipse.
public class C_Compile { public static void main(String args[]){ String ret = compile(); System.out.println(ret); } public static String compile() { String log=""; try { String s= null; //change this string to your compilers location Process p = Runtime.getRuntime().exec("cmd /C \"C:\\MinGW\\bin\\mingw32-gcc-4.6.2.exe\" C:\\MinGW\\bin\\Hello.cpp "); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); boolean error=false; log+="\n....\n"; while ((s = stdError.readLine()) != null) { log+=s; error=true; log+="\n"; } if(error==false) log+="Compilation successful !!!"; } catch (IOException e) { e.printStackTrace(); } return log; } public int runProgram() { int ret = -1; try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("cmd.exe /c start a.exe"); proc.waitFor(); ret = proc.exitValue(); } catch (Throwable t) { t.printStackTrace(); return ret; } return ret; }} Errors:
mingw32-gcc-4.6.2.exe: error: CreateProcess: No such file or directory Can anyone tell me where to place my Source .cpp File. Thanks