Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Garg - 11 Nov 2006 06:15 GMT
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
Karl Uppiano - 11 Nov 2006 06:20 GMT
> Hi All,
>
[quoted text clipped - 4 lines]
> 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?
Garg - 11 Nov 2006 06:26 GMT
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

> > Hi All,
>
[quoted text clipped - 5 lines]
> > Tarun GargDo 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?
Karl Uppiano - 11 Nov 2006 08:08 GMT
> Thanks for Reply,
>
[quoted text clipped - 5 lines]
> 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.
Garg - 13 Nov 2006 07:24 GMT
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

> > Thanks for Reply,
> >
[quoted text clipped - 25 lines]
> vendors. Using Google, I think I rounded up everything a person would need
> for this in less than 15 minutes. Google is your friend.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.