您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页Eclipse下使用Runtime.getRuntime().exec启动ja

Eclipse下使用Runtime.getRuntime().exec启动ja

来源:化拓教育网

window7系统下实验(linux下路径格式和windows下不一样) Eclipse下使用Runtime.getRuntime().exec启动ja

RunTime.getRuntime().exec("java My_Program");System.exit(0); which would start a whole new JVM running your program, and then kill the original. Not exactly pretty or efficient, but it would restart it.

 今天在Eclipse中写了用到 Runtime.getRuntime().exec("java MyTest"); 来启动一个新的java程序,无奈却无法启动MyTest类。

了!

最后修改代码如下:

2. Runtime.getRuntime().exec("java -classpath H:\\workspace\\javawork\\bin   cn.itcast.io.MyTest");

或者

或者

4.Runtime.getRuntime().exec("java -classpath bin   cn.itcast.io.MyTest");

程序正常运行!

原文:

转载于:https://www.cnblogs.com/juncaixingchi/p/3952628.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务