要用Runtime 类声明一个对象,用对象调用getRuntime()静态方法就可以调用exe文件了!!
for example:
import java.awt.*;
import java.io.*;
import java.awt.event.*;
public class execute
{
public static void main(String args[])
{
try
{
Runtime rt=Runtime.getRuntime();
File file=new File("C://windows","Notepad.exe");
rt.exec(file.getAbsolutePath());
}
catch(Exception e)
{
}
}
}