Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- Runtime r = Runtime.getRuntime();
- File dir=new File(".");
- File dir1=new File(".\\python\\a");
- System.out.println("Curr dir . : "+dir.getCanonicalPath());
- System.out.println("Curr dir .. : "+dir1.getCanonicalPath());
- p = r.exec(".\\python\\a\\a.exe",null,dir1);
- //p = r.exec("cmd /c c:\\python26\\python C:\\Users\\DevTech\\workspace\\callPython\\src\\a.py");
- //System.out.println("msg:"+msg);
- //sending the command arguments to python files(in the cases of "wait for" and "Repeat"
- // System.out.println("in pywedo"+msg);
- OutputStream os = p.getOutputStream();
- msg+="\n";
- os.write( msg.getBytes() );
- os.flush();
- os.close();
- //11/10/2011
- //p.waitFor();
- //p.waitFor();
- BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
- BufferedReader br1 = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- String line = "";
- while ((line = br.readLine()) != null)
- {
- System.out.println("returned: from Manager: "+line);
- status=line;
- }
- String line1="";
- while ((line1 = br1.readLine()) != null)
- {
- System.out.println("returned error: from Manager: "+line1);
- status=line1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement