aspose file tools
The moose likes Java in General and the fly likes Running the Java program as service. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Running the Java program as service." Watch "Running the Java program as service." New topic
Author

Running the Java program as service.

Arulanand Dayalan
Ranch Hand

Joined: Aug 10, 2005
Posts: 124
Hi,

I want to create have java program, which runs continously. This would hit check a table in Database for any new records and if there is anything it would post a message to another service. It would keep track of how many messages were posted and how many were completed at any point of time.I should have the ability to stop this service. When a stop sequence is initiated, it should wait till all the messages are processed and shutdown. I am looking for inputs on how to invoke the java program as service and the second part (stopping the service). I dont want to Java wrapper service or commons daemon api.

Thanks in Advance.

Regards,
Arul.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
I dont want to Java wrapper service

Why not? If you want to run Java code as a service, you will have to make it a service. Service Wrapper achieves this nicely.


Android appsImageJ pluginsJava web charts
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
There's no built-in support in Java for running as a service, so you will have to do something to make your code run as a service. One way is to use one of the several existing third-party libraries that "wrap" your Java code in a service.

If you do not like that, you can write your own code. It will not be Java code (no built-in service support, remember), but will be native C or C++ code.

If you want to write your own, you should read up on Java Invocation Interface.

Note that this interface is how the "java[.exe]" program works.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

This is also not that much related to threads. Sending this to Java in General -- intermediate.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Running the Java program as service.
 
Similar Threads
Java SMS application
Using SOAP with J2EE Application
Adding Java App. to Windows Service
popup window on remote machine
Java SMS application