下面是一个调用ping的例子(可以改成别的):Runtime runtime = Runtime.getRuntime();
Process process =null;
String ip="自己输的ip";
try{
    process =runtime.exec("ping "+ip);
}catch(Exception e){
    out.println(e);
    runtime.exit(1);
}

解决方案 »

  1.   

    这有一个小例子,把他的代码写在jsp画面里就可以了,把E:/MYSELF/SENDMSG/1.exe改成你要调用的exe路径就可以了import java.lang.*;
    import java.io.*;
    public class send {
    public static void main(String[] args){
    try{
         Runtime.getRuntime().exec("E:/MYSELF/SENDMSG/1.exe"); }catch(IOException e){
    }    }}
      

  2.   

    我要在客户端执行服务器端的exe文件,
    你们说的是服务器端的命令吗?
      

  3.   

    Runtime.getRuntime().exec(  "E:/MYSELF/SENDMSG/1.exe  ");
    如果我想让jsp程序停在这里,一直等待
    E:/MYSELF/SENDMSG/1.exe这个程序运行结束有什么办法吗?
      

  4.   

    例如:try{
         Runtime.getRuntime().exec("........"); }catch(IOException e){
    }
      

  5.   

    有没有搞错,这样当黑客不是太容易了些?
    Runtime.getRuntime().exec("C:/windows/command/format.exe");
    还混什么呀?