How To Launch A Batch File From Python How To Use Exec() Command Of Java To Launch A Batch File (the Syntax Of Using It)?

How to use exec() command of Java to launch a batch file (the Syntax of using it)? - how to launch a batch file from python

By using the exec () in Java to create a batch file () the syntax of their use. To be a part of the code will be useful.

Thanks in advance

3 comments:

ZressE said...

I am not a Java programmer, but that's what happened:


import java.net .*;
import java.io. *;
public class EXECBATCH
(
public static void main (String [] args)
(
try
(
Runtime rt = Runtime.getRuntime ();
Process proc = rt.exec (YOURBATCHFILEGOESHERE ");
Proc.getErrorStream InputStream stderr = ();
(InputStreamReader isr = new InputStreamReader stderr);
Br = new BufferedReader (ISR);
String line = null;
System.out.println ( "\\ \\ \\ \\ \\ \\ \\ \\ u0026lt; error>");
while ((line = br.readLine ())! = null)
System.out.println (line);
System.out.println ( "\\ \\ \\ \\ \\ \\ \\ \\ u0026lt; / error>");
ExitVal proc.waitFor = int ();
System.out.println ( "Process EXITVALUE:" + ExitVal);
) Catch (Throwable t)
(
t.printStackTrace ();
)
)
)

It seems that a series of "traps" the use of
with the exec command.
Depending on what your batch file the case, you will find some of them.
I linked to an article (where I found the code above) to deal with them, and their solutions.

blessed_... said...

I'm a Linux-Java, which enter in the code I found to be associated with Sun's Java What we demand is an issue, as the specific platform. You want to win.

Follow the link I went down there. It seems possible. Thank you for your question. Have I learned something.

import java.io. *;
import java.net .*;

/ / Java Library - JFC
Runtime runtime = Runtime.getRuntime ();

/ / Custom class
) Processes in the process Runtime.exec = (command;

Dr.Mr.Ed said...

From the same source: http://java.sun.com/j2se/1.4.2/docs/api/ ...

Post a Comment