windows下Java調用可執行文件

 緣起:java

  因爲沒有找到java轉換文件的接口,所以使用java調用exe文件進行文件轉換spa

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();
        }
    }

調用這個方法,就能夠實現文件的轉換了,和在命令窗口執行的結果同樣code

相關文章
相關標籤/搜索