RE: Run Windows' command in Java method

2003-08-15 Thread Cui Xiaojing-a13339
Got it. Thank you so much!!

Regards,


-Original Message-
From: Kwok Peng Tuck [mailto:[EMAIL PROTECTED]
Sent: 2003年8月15日 14:42
To: Tomcat Users List
Subject: Re: Run Windows' command in Java method


Beware of the pitfalls that can come from using Runtime.exec()

Have a look at this article first :
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html



Cui Xiaojing-a13339 wrote:

>Hello, 
>
>Thanks so much for the help. Now I only want to execute a SQL Server's import/export 
>utility in Java method. The utility could be executed using below command line in 
>Windows Command prompt window:
>
>C:> BCP flex.dbo.CF_load in e:\Flex\file\inbound.txt /f e:\Flex\prog\bcp.fmt /S flex 
>/U  /P 
>
>Does the utility could be executed in Java method? If I could use below method to run 
>it?
>
>   Runtime r=Runtime.getRuntime();
>   try{
>   
>   r.exec("BCP  flex.dbo.CF_load in e:\Flex\file\inbound.txt /f 
> e:\Flex\prog\bcp.fmt /S flex /U  /P ");
>   
>   }catch(IOException e){}
>
>Thanks&Regards,
>Xiaojing
>
>
>-Original Message-----
>From: engp0510 [mailto:[EMAIL PROTECTED]
>Sent: 2003年8月15日 13:07
>To: Tomcat Users List
>Subject: Re: Run Windows' command in Java method
>
>
>http://java.sun.com/docs/books/tutorial/native1.1/
>
>- Original Message - 
>From: "Cui Xiaojing-a13339" <[EMAIL PROTECTED]>
>To: "Tomcat Users List" <[EMAIL PROTECTED]>
>Sent: Friday, August 15, 2003 11:41 AM
>Subject: Run Windows' command in Java method
>
>
>  
>
>>Hello All,
>>
>>Do you know if windows' command could be executed in Java method? If yes,
>>
>>
>which API class method can be used to do it? Thanks a lot.
>  
>
>>Regards,
>>Xiaojing
>>
>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>  
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Run Windows' command in Java method

2003-08-15 Thread Johan Krisar
Xiaojing,

The API you're looking for is java.lang.Runtime. However, my personal 
advice would be to use OS-dependent calls sparingly - it makes your 
application platform dependent and typically makes it a lot less portable...

Cheers,

- Johan

---
  Johan Krisar
  johan.krisar(at)depicta.com
-

At 11:41 2003-08-15 +0800, Cui Xiaojing-a13339 wrote:
Hello All,

Do you know if windows' command could be executed in Java method? If yes, 
which API class method can be used to do it? Thanks a lot.

Regards,
Xiaojing


Re: Run Windows' command in Java method

2003-08-14 Thread Kwok Peng Tuck
Beware of the pitfalls that can come from using Runtime.exec()

Have a look at this article first :
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html



Cui Xiaojing-a13339 wrote:

>Hello, 
>
>Thanks so much for the help. Now I only want to execute a SQL Server's import/export 
>utility in Java method. The utility could be executed using below command line in 
>Windows Command prompt window:
>
>C:> BCP flex.dbo.CF_load in e:\Flex\file\inbound.txt /f e:\Flex\prog\bcp.fmt /S flex 
>/U  /P 
>
>Does the utility could be executed in Java method? If I could use below method to run 
>it?
>
>   Runtime r=Runtime.getRuntime();
>   try{
>   
>   r.exec("BCP  flex.dbo.CF_load in e:\Flex\file\inbound.txt /f 
> e:\Flex\prog\bcp.fmt /S flex /U  /P ");
>   
>   }catch(IOException e){}
>
>Thanks&Regards,
>Xiaojing
>
>
>-Original Message-
>From: engp0510 [mailto:[EMAIL PROTECTED]
>Sent: 2003年8月15日 13:07
>To: Tomcat Users List
>Subject: Re: Run Windows' command in Java method
>
>
>http://java.sun.com/docs/books/tutorial/native1.1/
>
>- Original Message - 
>From: "Cui Xiaojing-a13339" <[EMAIL PROTECTED]>
>To: "Tomcat Users List" <[EMAIL PROTECTED]>
>Sent: Friday, August 15, 2003 11:41 AM
>Subject: Run Windows' command in Java method
>
>
>  
>
>>Hello All,
>>
>>Do you know if windows' command could be executed in Java method? If yes,
>>
>>
>which API class method can be used to do it? Thanks a lot.
>  
>
>>Regards,
>>Xiaojing
>>
>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>  
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Run Windows' command in Java method

2003-08-14 Thread Cui Xiaojing-a13339
Hello, 

Thanks so much for the help. Now I only want to execute a SQL Server's import/export 
utility in Java method. The utility could be executed using below command line in 
Windows Command prompt window:

C:> BCP flex.dbo.CF_load in e:\Flex\file\inbound.txt /f e:\Flex\prog\bcp.fmt /S flex 
/U  /P 

Does the utility could be executed in Java method? If I could use below method to run 
it?

Runtime r=Runtime.getRuntime();
try{

r.exec("BCP  flex.dbo.CF_load in e:\Flex\file\inbound.txt /f 
e:\Flex\prog\bcp.fmt /S flex /U  /P ");

}catch(IOException e){}

Thanks&Regards,
Xiaojing


-Original Message-
From: engp0510 [mailto:[EMAIL PROTECTED]
Sent: 2003年8月15日 13:07
To: Tomcat Users List
Subject: Re: Run Windows' command in Java method


http://java.sun.com/docs/books/tutorial/native1.1/

- Original Message - 
From: "Cui Xiaojing-a13339" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 11:41 AM
Subject: Run Windows' command in Java method


> Hello All,
>
> Do you know if windows' command could be executed in Java method? If yes,
which API class method can be used to do it? Thanks a lot.
>
> Regards,
> Xiaojing
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Run Windows' command in Java method

2003-08-14 Thread engp0510
http://java.sun.com/docs/books/tutorial/native1.1/

- Original Message - 
From: "Cui Xiaojing-a13339" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 11:41 AM
Subject: Run Windows' command in Java method


> Hello All,
>
> Do you know if windows' command could be executed in Java method? If yes,
which API class method can be used to do it? Thanks a lot.
>
> Regards,
> Xiaojing
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]