Urgent! executing c code from java
hello
I need to execeute or call whole c program from java.
the c program works as follows:
it take input file from the command line and it return output file
I have used the following java code to call c code\
Code:
String line;
String output1 = "";
Process p = Runtime.getRuntime().exec("cp1.exe");
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
output1 += (line + '\n');
}
input.close();
although the c code works fine when it is executed from visual c++ also the exe file works fine but when I call exe file from java it doesn't work
can please tell me what shall I do??