Slow execution of a Unix process launched by Runtime.getRuntime ().exec ()

Discussion in 'Java' started by MARTIN Herve \(EXT\), Nov 27, 2003.

  1. Hi all,

    I have a Java application using graphical features and dealing with Orbix
    (CORBA).
    This application is launched by a Unix shell script doing some environment
    configurations before launching the actual Java application.

    If I execute this Unix shell script through a small Java program using
    Runtime.getRuntime().exec() the execution becomes very very slow.
    Has anybody got an idea why??

    Hervé.

    Java 1.4.2 is used;
    The application runs on Sun

    He is the small Java program
    class BasicLaunch
    {
    Process process;

    void test () {
    try {
    process = Runtime.getRuntime ().exec (new String[]
    {"/home/runesc/application_script"});

    process.waitFor ();
    }
    catch (Exception e) {
    System.out.println ("ERROR: "+e);
    System.exit (1);
    }
    System.out.println ("launched");
    }

    public static void main (String[] arg) {
    BasicLaunch basicLaunch = new BasicLaunch ();
    basicLaunch.test ();
    }
    }
    MARTIN Herve \(EXT\), Nov 27, 2003
    #1
    1. Advertising

  2. "MARTIN Herve (EXT)" <> wrote in message
    news:bq4nga$ffd$...
    > Hi all,
    >
    > I have a Java application using graphical features and dealing
    > with Orbix (CORBA). This application is launched by a Unix
    > shell script doing some environment configurations before
    > launching the actual Java application.
    >


    A fairly common scheme on *any* platform I should think.

    >
    > If I execute this Unix shell script through a small Java program
    > using Runtime.getRuntime().exec() the execution becomes
    > very very slow. Has anybody got an idea why??
    >


    <SNIP CODE>

    Others, who may be experts in your platform may be able to suggest possible
    reasons, as there may-well be platform-specific factors involved. I would
    just like to ask:

    Why use a Java program to launch a shell script which launches
    another Java program ?

    You end up with two JVM instances, consuming probably not inconsiderable
    resources, for seemingly little benefit. Could this, perhaps, be
    contributing to your problem ? My general view:

    Use scripting languages for application set up and launch,
    and use fully-fledged application development languages
    [like Java] for just that - application development

    Rememeber, Java, not JavaScript, is coded here ;) !

    I hope this helps.

    Anthony Borla
    Anthony Borla, Nov 27, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zsolt Koppany
    Replies:
    2
    Views:
    7,103
    SaintMagoo
    Mar 5, 2011
  2. paul brown
    Replies:
    3
    Views:
    5,550
    deepa gr
    Feb 17, 2009
  3. Jakir
    Replies:
    4
    Views:
    3,218
    Jakir
    Sep 1, 2004
  4. Replies:
    4
    Views:
    24,060
    vivek_kothari
    Jan 12, 2010
  5. Replies:
    12
    Views:
    4,951
    Roedy Green
    Apr 19, 2009
Loading...

Share This Page