how can we run *.bat file using java code ???
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jay_teraiya
Posted On:   Monday, September 5, 2005 08:15 AM


hello,

I want to run *.bat file from my servlet ? how can we run that file ?

Thanks
Jay Teraiya

Re: how can we run *.bat file using java code ???

Posted By:   Almagest_FUTT  
Posted On:   Monday, September 5, 2005 12:50 PM


java.lang.Runtime:

public Process exec(String cmdarray[], String envp[], File dir);
/**
* Executes the specified command and arguments in a separate process with
* the specified environment and working directory.
* If there is a security manager, its checkExec
* method is called with the first component of the array
* cmdarray as its argument. This may result in a security
* exception.
* Given an array of strings cmdarray, representing the
* tokens of a command line, and an array of strings envp,
* representing "environment" variable settings, this method creates
* a new process in which to execute the specified command.
*
* If envp is null, the subprocess inherits the
* environment settings of the current process.
*
* The working directory of the new subprocess is specified by dir.
* If dir is null, the subprocess inherits the
* current working directory of the current process.
*
*
* @param cmdarray array containing the command to call and
* its arguments.
* @param envp array of strings, each element of which
* has environment variable settings in format
* name=value.
* @param dir the working directory of the subprocess, or
* null if the subprocess should inherit
* the working directory of the current process.
* @return a Process object for managing the subprocess.
* @exception SecurityException if a security manager exists and its
* checkExec method doesn't allow creation of a
* subprocess.
* @exception NullPointerException if cmdarray is
* null
* @exception IndexOutOfBoundsException if cmdarray is an
* empty array (has length 0).
* @exception IOException if an I/O error occurs.
* @see java.lang.Process
* @see java.lang.SecurityException
* @see java.lang.SecurityManager#checkExec(java.lang.String)
* @since 1.3
*/
About | Sitemap | Contact