windows下Java调用可执行文件

 缘起:

  由于没有找到java转换文件的接口,因此使用java调用exe文件进行文件转换

public void convertFile(){
        Runtime rn = Runtime.getRuntime();
        Process p =null;
        try{
            p = rn.exec("D:/convert/Convert.exe D:/convert/my.ifc D:/convert/tmp.dae");
        }catch (Exception e){
            e.printStackTrace();
        }
    }

调用这个方法,就可以实现文件的转换了,和在命令窗口执行的结果一样

猜你喜欢

转载自www.cnblogs.com/baby123/p/11018225.html