Running Shell or System Command in JAVA

前端 未结 3 1042
执笔经年
执笔经年 2021-01-16 16:27
private void myFunction(String userName){
    String fileName = this.generateFile(userName);
    String[] command = new String[4];
    command[0] = \"cmd\";
    comm         


        
3条回答
  •  难免孤独
    2021-01-16 17:16

    Try this:

    final Runtime rt = Runtime.getRuntime();
    rt.exec(your command line here as a single String);
    

提交回复
热议问题