• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making a JAVA Application Run 24x7....  RSS feed

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I want to make a JAVA application which runs 24x7 in the background and performs certain tasks! I know what the tasks that the application should do, but I don't know how to make it run 24x7. Could you guys please guide me in where to start off!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12558
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ummm....start it up, and don't kill it....

basically you'd want some kind of loop:



or did you have something specific you wanted help with?
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Somnath!

Hm, you didn't mention the operating system of the machine on which your application should run...

If it is a Windows computer I would start the application as a Windows service:

Running Java Application as a Windows Service


Regards,

John
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the code is supposed to do a 2-3 tasks. One of them is to check a few folder and if some file is generated in that folder. It should copy them into another folder and some other FTP tasks. Is there any way i can make it platform independent? But mainly it is for UNIX (Sun Solaris).

I also thought about making into an infinite loop! But i thought there must be a better way! That's why is asked this question here!
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you need is a cron job. Google for Quartz. Of course you will still need some application to create the job and schedule it. Advantage of using something like quartz is that you can schedule it to run for ever. No need for the while loop.
 
Ulas Ergin
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somnath Mallick wrote:Well, the code is supposed to do a 2-3 tasks. One of them is to check a few folder and if some file is generated in that folder. It should copy them into another folder and some other FTP tasks. Is there any way i can make it platform independent? But mainly it is for UNIX (Sun Solaris).

I also thought about making into an infinite loop! But i thought there must be a better way! That's why is asked this question here!


if it is intented for unix ,you might consider scheduleing a crontab/at job.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!