Click to See Complete Forum and Search --> : Java command line
Charbel
January 26th, 1999, 08:59 AM
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.
Zafir Anjum
January 26th, 1999, 11:26 AM
See the docs for the class Runtime. The exec() method is probably what you
are looking for
Charbel
January 26th, 1999, 01:57 PM
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
vinjava
February 9th, 2001, 06:33 AM
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
kannanbalu
February 12th, 2001, 02:24 PM
Try the foll. if you are working in windows os.
comp.exec("cmd /c javac -classpath "+classPath+" "+filename");
sanjubose
February 12th, 2001, 10:38 PM
but how to give the input from one process to another process started by a java program.
sanjubose
Geert Arys
February 13th, 2001, 03:02 AM
Hi,
Recently, I posted this:
http://codeguru.earthweb.com/bbs/wt/showpost.pl?Board=java&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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.