Re: can you give me any hint for writing a background java program?
"Garg" <sendtogarg@gmail.com> wrote in message
news:1163226384.978088.262020@k70g2000cwa.googlegroups.com...
Thanks for Reply,
Basically requirement is to write a process which runs 24*7 and monitor
some conditions in the database and it has to send out a mail if that
condition is fullfilled.
so please suggest me what will be the best way.
Thanks in advance,
Tarun Garg
Thanks for clarifying. Without getting into specifics, you just need to
write a console Java application to do this. That is, no Swing, no AWT, just
a program that starts with void main(String[] args). You just code it to run
forever. If you need to check something periodically, you might consider
using java.util.Timer. You will need to use JDBC or other database access
library to monitor the database. You will probably need to use the JavaMail
API to send mail. Refer to the Java API documentation for details. It is all
I usually need.
If you need your application to start automatically, and run as a service in
Windows, you will need to use one of the many Java service runners that let
you run Java as a service. Google "Java Windows Service". Alternatively, you
can run your application as a daemon with a simple shell script. Google
"Java Unix daemon".
This project uses a number of Java technologies. You might have to download
JavaMail from java.sun.com and possibly JDBC drivers from third party
vendors. Using Google, I think I rounded up everything a person would need
for this in less than 15 minutes. Google is your friend.