Hi Renaud,

to run the command-line commands like copy, mdir,... the only important thing to
do it is to give the shell to the exec("...")
So your commynd would lok like this:
         r.exec("command.com /c  copy t1.java t2.java");
I hope it helps.

Regards,
jan


CAZOULAT Renaud CNET/DIH/REN wrote:

> 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".

--

mit freundlichem Gru�
Jan Kuras


/=======================================================\
|  BBL Software GmbH     Tel: +49 5251 1358 0           |
|  Tudorfer Str.24       Fax: +49 5251 1358 21          |
|  33178 Borchen-Alfen   mailto:[EMAIL PROTECTED]               |
|  Projektmanagement mit >Projekta<�: http://www.bbl.de |
\=======================================================/

===========================================================================
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".

Reply via email to