废话不多讲 直接贴代码:
package RegisterOxc;
import java.io.IOException;
public class Test {
public static void main(String[] args) {
try {
Runtime runtime = Runtime.getRuntime();
runtime.exec("regsvr32 C:\\OCX\\MVodOcx.ocx");
//runtime.exec("regsvr32 -u C:\\OCX\\MVodOcx.ocx");
} catch (IOException e) {
e.printStackTrace();
}
}
}