That's because copy is not an executable, it's a builtin command of
"command.com".
On unix, "cp" *is* a command (althouth "cd" is not), so it would be valid to
do what you want. But apparently you're working with windows.
So you may test either (I have no time to do that, but still interrested by
the result :-) :
1) instead of "copy toto titi", "start copy toto titi"
2) create a mycopy.bat which do a "@copy %1 %2" and then call "mycopy toto
titi"
(or perhaps a "start mycopy toto titi")
obviously, it is a good idea to write the whole path of mycopy ;-)
hope that helps
renaud
> -----Message d'origine-----
> De: Vijay Menon [mailto:[EMAIL PROTECTED]]
> Date: lundi 20 septembre 1999 10:21
> �: [EMAIL PROTECTED]
> Objet: [JAVA3D] Runtime commands
>
>
> Hi
>
> This is slightly out of topic (to say the least) but
> could someone help me on this?
>
> How can I pass a command at the dos prompt? I tried
> the following code but it only works for windows
> commands. I want to send a command like "copy x.txt
> x.java" or something as a string value whose
> parameters will be set at runtime. I am showing the
> static method of my class file. Here, the copy
> statement doesn't work but notepad gets opened.
>
> Thanx in advance
> Vijay
>
> public static void main(String args[])
> {
> try {
> Runtime r = Runtime.getRuntime();
> r.exec("copy t1.java t2.java");
> r.exec("c:\\windows\\notepad.exe");
> System.out.println("Hi");
> }catch(IOException e) {System.out.println(e);}
> }
>
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.com
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff JAVA3D-INTEREST". For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".