由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Re: unix环境下如何在java程序中执行命令行?
相关主题
Java练习题 6Java runtime?
Java练习题 2Re: how to initialize corba object orb in servlet
问个java gabarge collection的问题说说clone咋违反了类继承的原则来的?
[转载] Re: 觉得自己很笨Re: 怎么能是JAVA里的数组开的更大?
Java练习题 7java String
Test your PC speedRe: The real Risk
折腾了一天,实在是绝望了,请教请教.net vs. J2ee(zhuan)
Re: How can I call another program from Java?Java Telnet Client Implementation v0.99Beta
相关话题的讨论汇总
话题: process话题: theprocess话题: stream话题: output话题: public
进入Java版参与讨论
1 (共1页)
p******a
发帖数: 6
1
Runtime.exec() returns a Process which has an input
stream and an output stream. You should read from
the Process's output (called getInputStream though)
and dump it to the screen. Windows' implementation
doesn't follow the spec (did you use Microsoft's
VJ++? :))
The following code works:
import java.io.*;
public class tstr
{
public static void main(String args[])
{
Runtime r = Runtime.getRuntime();
Process theProcess = null;
try {
theProcess = r.exec("ls -l");
1 (共1页)
进入Java版参与讨论
相关主题
Java Telnet Client Implementation v0.99BetaJava练习题 7
Re: [转载] 如何看某个端口是否被占用?(use UNIX command or ..)Test your PC speed
JAVA RUNTIME.EXEC 一问折腾了一天,实在是绝望了,请教请教
question about JbuilderRe: How can I call another program from Java?
Java练习题 6Java runtime?
Java练习题 2Re: how to initialize corba object orb in servlet
问个java gabarge collection的问题说说clone咋违反了类继承的原则来的?
[转载] Re: 觉得自己很笨Re: 怎么能是JAVA里的数组开的更大?
相关话题的讨论汇总
话题: process话题: theprocess话题: stream话题: output话题: public