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

  • Thread starter MARTIN Herve \(EXT\)
  • Start date
M

MARTIN Herve \(EXT\)

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 ();
}
}
 
A

Anthony Borla

MARTIN Herve (EXT) said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top