shell scripts in solaris frm java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: shell scripts in solaris frm java

  1. #1
    Join Date
    Dec 2006
    Posts
    1

    shell scripts in solaris frm java

    Hi Guys,

    How to run the shell scripts from java under solaris? Following is the code what i have written..

    Process p1 = Runtime.getRuntime().exec("/opt.sh");
    p1.waitFor();

    This is working perfectly under Linux OS. But got confused why it is not running under solaris..Can anybody please give me suggestions?

    The error am getting is..

    java.io.IOException: /export/home0/oracle/Testing/Day_12122006/SS7/opt.sh: cannot execute
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:54)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)


    Thanks in advance..

  2. #2
    Join Date
    Dec 2006
    Location
    Kerala,India
    Posts
    51
    Make sure that, you have given execute permission for ./opt.sh
    otherwise try giving
    Runtime.getRuntime().exec("sh ./opt.sh")
    or
    Runtime.getRuntime().exec(new String []{"sh","./opt.sh"})

Similar Threads

  1. Replies: 1
    Last Post: 01-17-2011, 01:50 AM
  2. Java book
    By Lou in forum Java
    Replies: 9
    Last Post: 09-19-2007, 05:58 AM
  3. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 06:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center