Calling Python program from Java -


i have console application developed in c python language. need call program function java code. also, need pass arguments such list<> main function once called. have researched found this link, j python code. have similar facility c python?

import java.io.ioexception;  import org.apache.commons.logging.log; import org.apache.commons.logging.logfactory;  public class systemcall{          private static log logger = logfactory.getlog(systemcall.class);      public static int execute(string command) {         int result = 0;         if (command == null){                 throw new runtimeexception("harness command null");         }         runtime r = runtime.getruntime();          try {             process p = r.exec(command);             try {                 if (p.waitfor() != 0) {                     result = p.exitvalue();                 }             } catch (interruptedexception e) {                 logger.error("system call interupted.", e);                 //todo             } {                 //todo             }         } catch (ioexception e) {                 logger.error("io error in system call.", e);                 //todo         }         return result;      }  } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -