File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes run programs from a java source file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "run programs from a java source file" Watch "run programs from a java source file" New topic

run programs from a java source file

arturo gennaro

Joined: Feb 03, 2003
Posts: 2
I want to start some java executables from a java source fle.To be specific, at first I want to load 10 exes that have a listening socket each,then 20,that connect to the previous sockets and wait for socket connections, too,...etc.It is obvious that in order to start the second group of exes,i must be certain that all exes of thaefirst group are loaded and listen to connections correctly.
The only method i have found in java to run external exes is Runtime.exec().However this method is very slow and takes a very long time to make them start,compared to executing them through windows.Adding sleep() between calls doesn't help,unfortunately.
Is there a way to use a system call from a system independent platform as java?It would help me a lot.
Or else, has anybody any idea on how to start a bunch of exes from a java source file very quickly?
Thanks a lot
Hari Gangadharan
Ranch Hand

Joined: Mar 08, 2001
Posts: 73
If it is java classes then you may be able to execute it directly as ClassName.main(). You may have to do that in separate threads.
Is there any reason why you should be running these java programs using a different Java VM?
[ February 03, 2003: Message edited by: Hari Gangadharan ]

<B>Hari Gangadharan</B><BR>Unix is user friendly..<BR>but it chooses to whom it is friendly with!
I agree. Here's the link:
subject: run programs from a java source file
It's not a secret anymore!