This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java program terminates Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Java program terminates" Watch "Java program terminates" New topic
Author

Java program terminates

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi

I have a java program that will run infinitely

In the code I added for(;;)

But when I start program in the unix machine using JAVA classname command from PUTTY session it’s started running. As soon as I close the Putty session the program is terminated.
We are expecting the java program to run even after closing the PUTTY session.

Whether the fork command will help ?

Please assist us
Istvan Kovacs
Ranch Hand

Joined: May 06, 2010
Posts: 100
This has nothing to do with Java. Unix will terminate your shell and its subprocesses when you terminate the connection.
Use background execution (someCommand &), fg and bg, or the program called screen that can give you sessions in virtual terminals. Or run your Java code as a service (jWrapper, YAJSW).
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Or nohup.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Java program terminates
 
Similar Threads
Running java applications in virtual machine without a terminal
unable to get tomcat home page displayed in browser
How to run remote command from a JSP
PuTTy backspace
How can my program tunnel