Hi,
does Anyone know how to execute a command line command from within java code?
I am using windows N.T. and i would like to execute a command from a Java program.
Thanks.
charbel.
Printable View
Hi,
does Anyone know how to execute a command line command from within java code?
I am using windows N.T. and i would like to execute a command from a Java program.
Thanks.
charbel.
See the docs for the class Runtime. The exec() method is probably what you
are looking for
Hi,
Thanks for replaying to my message i have used the following :
String classPath = "d:\\javastar\\javastar.zip;f:\\bkw1\\lib\\rescue.zip;c:
\jdk1.1.6\\lib\\classes.zip;F:\\bkw1\\source\\classes;d:
\\jdk\\lib;d:\swingall\\swingall.jar ";
Runtime comp = Runtime.getRuntime();
comp.exec("javac -classpath "+classPath+" "+filename);
but it seems that nothing happens when i run the program!!!!!!!.
what i want is to have:
javac -classpath d:\\javastar\\javastar.zip;f:\\bkw1\\lib\\rescue.zip;c:
\\jdk1.1.6\\lib\\classes.zip;F:\\bkw1\\source\\classes;d:
\\jdk\\lib;d:\\swingall\\swingall.jar filename
executed at the command prompt.
thanks.
charbel
plese get the args values into the variables in your programe and display it back if more than one args loop it
vinay kumar s.v
Try the foll. if you are working in windows os.
comp.exec("cmd /c javac -classpath "+classPath+" "+filename");
but how to give the input from one process to another process started by a java program.
sanjubose
Hi,
Recently, I posted this:
http://codeguru.earthweb.com/bbs/wt/...a&Number=15098
You can easily couple an output stream of one process to an output stream of another process using the information in this post.
Regards,
Geert Arys