• Post Reply Bookmark Topic Watch Topic
  • New Topic

java program on solaris server  RSS feed

 
divya madala
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to run a java program on a solaris server by connecting to it through SSH. I run the program with the command java <classname>.
My program runs approximately 3 to 4 days.
Do I need to keep my connection (to Unix server)live till my program is through?
Or is there a way to make it run though you terminate the connection to the server.
I'm totally new to Unix, I appreciate your help,
Divya
 
Ashish Pagare
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can run your java program in background and check the status using your log files.
The simplest way to run a background process is by putting a '&' at the end of your command (could be a shell script or your java command itself)
 
divya madala
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ashish. It works!!!
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it doesn't work if you log out. The only way to do that is to run nohup <command>
 
Ashish Pagare
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The nohup is often unnecessary, but it doesn't hurt to use it.
 
divya madala
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I thought it worked with &. But when I logout the process is killed automatically.
When I use nohup, it doesn't let me logout with a message "there are jobs running".
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm... strange, I runs it at work with no problem. Read the man page carefully, nohup is designed to allow you to run it in background and log out.
 
Brian McNamara
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually...the shell will dictate whether the job continues to run or not. In the Bourne shell, you have to use the nohup otherwise the job will exit on user logout. However, in other shells (Korn shell at the very least), the nohup is unnecessary.
To determine what shell you are running, type in the following command at the shell prompt:
echo $0
It should display what shell you are running.
Hope this helps!
Brian
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by divya madala:
Actually I thought it worked with &. But when I logout the process is killed automatically.
When I use nohup, it doesn't let me logout with a message "there are jobs running".

This is only a advisory message. When you attempt to log out a second time in succession you will get no complaint.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!