Alper Aslan (DataSel) <[EMAIL PROTECTED]> wrote:
>  How can I calling an executable on my harddisk (c:\\blahblah.exe)


This runs "c:\blahblah.exe arg1 arg2" and prints the results on the screen:


Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec( new String[] { "c:\\blahblah.exe", "arg1",
"arg2" } );
DataInputStream in = new DataInputStream( process.getInputStream() );
PrintWriter out = servletResponse.getWriter();

String line = null;
while ( ( line = in.readLine() ) != null )
{
    out.println( line );
}



I stole the code from Jason Hunter's servlet programming book
<http://www.servlets.com/>, which contains a few pages about running
executables.


Erik

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to