• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Making a JAVA Application Run 24x7....

 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
lowercase baba
Posts: 13072
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Is that a spider in your hair? Here, threaten it with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic