text.txt");或 test.sh:!/bin/bash top -n 1>test.txt Runtime.getRuntime().exec("test.sh");Runtime.getRuntime().exec("bash test.sh");多试试,肯定是这样调用的,只有这个方法是调用本地进程的。" />

java如何调用Linux下的top命令

Runtime.getRuntime().exec("top -n 1>text.txt");或 test.sh:!/bin/bash top -n 1>test.txt Runtime.getRuntime().exec("test.sh");Runtime.getRuntime().exec("bash test.sh");多试试,肯定是这样调用的,只有这个方法是调用本地进程的。
java如何调用Linux下的top命令
Runtime.getRuntime().exec("top -n 1>text.txt");


test.sh:
#!/bin/bash
top -n 1>test.txt

Runtime.getRuntime().exec("test.sh");
Runtime.getRuntime().exec("bash test.sh");

多试试,肯定是这样调用的,只有这个方法是调用本地进程的。2007-12-18
mengvlog 阅读 380 次 更新于 2025-10-29 01:30:45 我来答关注问题0
檬味博客在线解答立即免费咨询

Java相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部