can you give me any hint for writing a background java program?

G

Garg

Hi All,

I a write a process in java which will run in the background.

Can you give me any hint for this or any sample code.

thanks in advance,
Tarun Garg
 
K

Karl Uppiano

Garg said:
Hi All,

I a write a process in java which will run in the background.

Can you give me any hint for this or any sample code.

thanks in advance,
Tarun Garg

Do you mean a service or daemon without a console or UI? Or just a thread
that does some processing in the background of a Java application?
 
G

Garg

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
 
K

Karl Uppiano

Garg said:
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.
 
G

Garg

Hi karl,

thanks for the suggestion,

I think for writing a thread will be a good option.

or do you suggest me any thing else.

Thanks
Tarun Garg

Karl said:
Garg said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top