WinRun4J 0.3.3 Released

A new version of WinRun4J is available. It contains the following fixes and new features:

  • Moved service name, description and controls accepted to INI file
  • Refactored Service interface and added AbstractService helper class
  • Implemented FileAssociations helper class
  • Greatly improved the Registry API
  • Option to log to console and file
  • Log file rolling
  • Fix for relative log file path

The Registry API has been refactored to be easier to use (no need to open/close).

The Service API is now also much easier to use, with an AbstractService class. This makes the example service implementation much simpler:

package org.boris.winrun4j.test;

import org.boris.winrun4j.AbstractService;
import org.boris.winrun4j.EventLog;
import org.boris.winrun4j.ServiceException;

/**
 * A basic service.
 */
public class ServiceTest extends AbstractService
{
    public int serviceMain(String[] args) throws ServiceException {
        int count = 0;
        while (!shutdown) {
            try {
                Thread.sleep(6000);
            } catch (InterruptedException e) {
            }

            if (++count % 10 == 0)
                EventLog.report("WinRun4J Test Service",
                      EventLog.INFORMATION, "Ping");
        }

        return 0;
    }
}

The shutdown variable is set to true when the service is requested to close by the service control manager.

You can download the new version from the WinRun4J Sourceforge Site.