java编译运行cpp文件
来源:互联网 发布:安卓旧版本软件 编辑:程序博客网 时间:2024/09/21 06:37
try { final long timeout = 3000; // 限制的执行时间(毫秒) String cmd = "g++ *.cpp -o your_app_name"; final long starttime = System.currentTimeMillis(); final Process process = Runtime.getRuntime().exec(cmd); // 执行编译指令 if (process != null) { InputStream is = process.getInputStream(); // 获取编译命令输出 InputStream error = process.getErrorStream(); // 获取编译命令错误输出 new Thread() { public void run() { while (true) { try { sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } if (System.currentTimeMillis() - starttime > timeout) { // 超时 process.destroy(); } } } }.start(); }} catch (IOException e) { e.printStackTrace();}
0 0
- java编译运行cpp文件
- 在Mac终端编译运行cpp格式c++文件
- window中运行g++编译当前文件夹中的*.cpp文件
- .c/.cpp文件windows命令行下编译,运行.c/.cpp文件
- .c/.cpp文件windows命令行下编译,运行.c/.cpp文件
- gcc编译cpp文件
- MATLAB编译cpp文件
- MATLAB编译cpp文件
- CL编译CPP文件
- 手动编译运行java文件
- Matlab编译和运行.cpp
- centos编译并运行.cpp
- 编译Qt的cpp文件
- makefile编译所有cpp文件
- mac下使用vim gcc/g++ 编译cpp(c++)文件并运行
- 在Linux(Ubuntu)中使用终端编译并运行.c和.cpp文件
- java文件编译运行----‘’足球论之java文件运行编译先编译‘’
- 使用ant编译打包运行java文件
- iOS 数据持久化
- Android给ListView设置分割线Divider样式
- 设计模式之原型模式
- 电子词典
- 在Quick Cocos2d-x中给CocosStudio中导出的UI(Widget)控件增加触摸(touch)事件
- java编译运行cpp文件
- Linux shell 之日期检查
- MySQL 5.6 复制介绍
- java---避免空指针
- 隐视调用
- AJAX是什么?AJAX的交互模型(流程)?同步和异步的区别?AJAX跨域的解决办法?
- Storm 多语言支持之ShellBolt原理及改进
- 用string[]表示同学姓名
- Android开发性能优化大总结