Advertisement

05.05.2008 at 11:29PM PDT, ID: 23378629
[x]
Attachment Details

I want to run a shell script containing the rsh command from a java program and redirect output to file

Asked by Amit_Dogra in Shell Scripting, Developer Tools

Tags: java

I have a shell script that contains the following command

rsh <ip of machine> free > abc.txt
This shell script I  am running from Linux and it works fine.    However if I am running this from a java program on the same box it is not working. This is the code I am using

try
{
     Runtime runtime = Runtime.getRuntime();
      Process P= null;
 
     String path = "<PATH WHERE THE SHELL SCRIPT RESIDES>"
                   
       P = runtime.exec(path);
             int wait = P.waitFor();
              }
        catch(Exception e)
        {

        }
        
        Start Free Trial
 
Keywords: I want to run a shell script containing th…
 
Loading Advertisement...
 
[+][-]05.06.2008 at 04:14AM PDT, ID: 21506233

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 03:23AM PDT, ID: 21514823

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 04:43AM PDT, ID: 21515257

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 08:38AM PDT, ID: 21517550

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 08:49AM PDT, ID: 21517657

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:21AM PDT, ID: 21517960

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:26PM PDT, ID: 21528157

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 11:10PM PDT, ID: 21530667

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 01:52AM PDT, ID: 21531183

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Shell Scripting, Developer Tools
Tags: java
Sign Up Now!
Solution Provided By: Mehuge
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628