Java运行时exec [英] Java runtime exec
本文介绍了Java运行时exec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Java中使用系统执行exec
Runtime.getRuntime令人惊讶的是,与路径,目录和文件相关的一切都无法正常工作
我不知道为什么,只是想知道是否有任何替代?
解决方案另一种方法是使用 ProcessBuilder 类,它有一个更干净的接口,但你的主要问题可能与操作系统如何处理命令行有关,并没有太多的Java可以做到帮助你。
I am trying to do something using system exec in Java
Runtime.getRuntime().exec(command);
Surprisingly everything that is related with paths, directories and files is not working well
I don't get why and just want to know is there any alternatives?
解决方案 The alternative is to use the ProcessBuilder class, which has a somewhat cleaner interface, but your main problem is probably related to how the OS processes command lines, and there isn't much Java can do to help you with that.
这篇关于Java运行时exec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文