Hi ,
I am trying to call c++ exe from java applet.For this purpose am using processbuilder.My code is as follows
ProcessBuilder pb = new ProcessBuilder(s);
Process process = pb.start();
final InputStream is = process.getInputStream();
OutputStream out = process.getOutputStream();
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out))); pw.println(1);
pw.println(1 +"" +2);
final InputStream is = process.getInputStream();
new Thread(new Runnable() {
public void run() {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (java.io.IOException e) {
}
}
}).start();
The c++ exe looks like this when started:
1.Find the shortest path from s to t.
2.Find the associating path from s to t within length l.
3.Find the associating path from s to t within (1+beta) times of the shortest distance from s to t.
4.Exit
Please input the command (1-4):
once u input the command ,for example 1 we get
Please input s and t, separated by space:
After this you enter two numbers and you will get a network.
Am able to get till Please input s and t, separated by space: .After that it does not display anything.How do i get it to accept pw.println(1+""+2) and display the final output.
Help!
Thanks.