Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Advanced
Feb 20, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Execute an External Program Without Using JNI

The secret lies in the Runtime class. Runtime contains the method exec, which takes the basic form of:
Process exec(String command) or
Process exec(String[] comdarray) or
Process exec(String[] cmdarray, String[] envp, File dir)

Where command is the name of the executable, comdarray contains the exe name and arguments, envp contains the environment variables, and File contains the file name. exec returns the abstract object Process, whose getInputStream() and getOutputStream() can be used to collect I/O information on the running process.
Tanzim Husain
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date