args = new String[] {
"mount",
"-t",
"cifs",
"-o",
"user=root",
"-o",
"password=password",
"\\home\\sharefolder\\test",
 "/home/test" }Process ps = Runtime.getRuntime().exec(args);这么执行成功不了,有高手指点一下么

解决方案 »

  1.   

    使用java.lang.ProcessBuilder试试,比Runtime好用,功能也多些
      

  2.   

    单独可以用跑么?
    有什么输出?
    加上mount的完整路径试试。
      

  3.   

    权限什么的有吗?如果没有,写个shell什么,su改下用户再mount,java里调用该shell
      

  4.   

    权限我在这已经给出了呀
    "user=root",
    "-o",
    "password=password",
      

  5.   

    看看process的exitValue()或process.getOutputStream()信息,有什么提示
      

  6.   

    public class Test { public static void main(String[] args) {
                    String mountCommand = ""//这里写你的命令就可以了
    try {
    Process p = Runtime.getRuntime().exec(mountCommand);
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
    }
      

  7.   

    这个跟mount执行权限和访问路径/home/test权限不是一个概念吧
      

  8.   

    你的java程序应该不会抛异常的,你看看error stream中是否有输出?
    另外楼上也说了,看看exit value。