我有代码:
val a = Seq("java","-jar \""+base.getCanonicalPath+"/sbt/sbt/bin/sbt-launch.jar\"")
val proc = Process(a)
proc.!<(
new ProcessLogger {override def buffer[T](f: => T): T = f
override def out(s: => String): Unit = println(s)
override def err(s: => String): Unit = println(s)
})
}
但是当我尝试运行它时,它会输出:
错误:无法访问jarfile“/home/remus32/.remus32/sbt/sbt/bin/sbt-launch.jar”
但路径是正确的,当我尝试在终端中运行它时,它有效吗?
答案 0 :(得分:2)
我发现您的代码存在两个问题:
-jar
一个单独的参数。以下对我有用(我确实修改了自己系统中某个sbt-launch jar的路径):
val a = Seq("java","-jar", "/Users/soong/Library/Caches/IntelliJIdea13/sbt/sbt-launch.jar")
val proc = Process(a)
proc.!<(
new ProcessLogger {override def buffer[T](f: => T): T = f
override def out(s: => String): Unit = println(s)
override def err(s: => String): Unit = println(s)
})