----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------



For UNIX, using Runtime.exec will allow the new process to run
as long as the servlet engine's JVM is running, AFAIK.  You can't
create a background (daemon) process by launching a new JVM
directly, but you probably could by using "nohup" if you don't mind
your code not being portable to non-UNIX platforms.  I won't try to
speak for Windows, but I imagine my first point would hold true.

As a related aside, what are the caveats when launching a long
running service from within the servlet engine's VM?  A few examples
that come to mind are an RMI server or a custom sockets-based
service for communicating with applets.  Do I have to maintain a
reference to an object or thread of this description for it not to be
garbage-collected?  Or is this really beyond the scope of a
servlet engine, only suited for a Java application server?

Russ





Philippe Johan 999900280 <[EMAIL PROTECTED]> on 01/19/2000 08:46:00
AM

Please respond to Java Apache Users <[EMAIL PROTECTED]>

To:   ishpal <[EMAIL PROTECTED]>, Java Apache Users
      <[EMAIL PROTECTED]>
cc:    (bcc: Russ Pridemore/GVL/BSM/MCI)
Subject:  Re:A conceptual problem



----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi ishpal,

the choice of running your java application in the same or in another JVM is
entirely up to you.  If you call the main method yourself in the code, then
the application will run in the same JVM.
You can also use use the java.lang.Runtim.exec methods with a command
line you would use to start your Java application.  In that case, you will
launch another JVM instance.
The second JVM should at least be available as long as the first JVM is.
To keep it up after the first JVM has died, you'll have to check, as it is not
specified in the javadoc.  You might also have to experiment with "start"
on Windows NT or for example using an & on Unix to launch it as a
background process.


regards

Johan Philippe


ishpal:
----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi,
I just wanted to know that if I invoke a java application from within
the servlet,
1)Would it start a new JVM or use the current JVM which is used by the
JServ.....?

2)If the java application is invoked from within the servlet,would it
also get destroyed when the servlet gets destroyed...?

I want to launch a java applicaton(which can be said as a deamon
process) from a servlet and should not go down until I want so, even if
the the servlet has been destroyed....

thanks and regards....
-Ishpal.


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]









--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to