Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Slow execution of a Unix process launched by Runtime.getRuntime ().exec ()

Reply
Thread Tools

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

 
 
MARTIN Herve \(EXT\)
Guest
Posts: n/a
 
      11-27-2003
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 ();
}
}


 
Reply With Quote
 
 
 
 
Anthony Borla
Guest
Posts: n/a
 
      11-27-2003

"MARTIN Herve (EXT)" <(E-Mail Removed)> wrote in message
news:bq4nga$ffd$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
system waiting for launched process AND forked processes Pierre Morel Ruby 5 02-17-2010 09:23 PM
Perl process as a unix background process gbostock@excite.com Perl Misc 14 08-15-2009 02:41 PM
Re: slow slow slow! Expert lino fitter Computer Support 0 12-10-2008 02:33 PM
disappearing process when launched from a web service Tim Mackey ASP .Net 0 07-27-2004 10:40 AM
Win32::Process - Limiting the number of processes launched from within a script Patrick Paquet Perl Misc 3 01-29-2004 10:11 AM



Advertisments