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

Major new feature is the dynamic native binding. This provides the ability to use native Windows API functions without having to write any JNI/native code. See native binding examples for more information.

Fixed a race condition in the service implementation for quick starting applications.

The launcher java library now requires java 1.5 minimum (due to use of annotations). The launcher executable is compatible with java 1.4 and above.

The following is a simple tool I hacked together in Java that downloads your twitter statuses to a directory, to test out the new WinRun4J Plugin for Eclipse. I wrote a simple Java class and then exported it to a single fat executable (console version): TwitterBackup.exe.

Note that you need Java to run this application: You can download it from here.

The following is a potentially useful hack if you have plenty of different java apps you need to launch from explorer but don’t want to create separate launcher files for each launcher configuration file.

Using Windows file associations we create a new file association for *.winrun4j to the WinRun4J launcher. The command executed is the new WinRun4J --WinRun4J:ExecuteINI command added in the previous release.

To install the plugin in eclipse go to Help->Software Updates… then select Add Site… then
add http://winrun4j.sourceforge.net and click OK. The select “WinRun4J Eclipse Plugin 0.1.0” and click Install… and follow the prompts.

Now unzip it into any folder, create a new directory called service and copy over the following files from the download:

WinRun4Jc.exe

service.ini

WinRun4J.jar

WinRun4jTest.jar

Now rename WinRun4Jc.exe to service.exe and you should have a folder that looks like this:

Now we need a command prompt with Administrator priveleges. This can be created in Vista/Windows7 by going Start->All Programs->Accessories, right-click on Command Prompt and select Run as Administrator:

Now change into the service directory you created above:

To register the service with the Windows Service Control Manager (SCM), run the following command:

C:\downloads\service>service.exe --WinRun4J:RegisterService

Now if you start up the Windows service viewer you should see the WinRun4J test service:

The main method is called from the WinRun4J launcher when the service is required to run. This method should not return until the service is shutdown.

The doRequest method is called by the WinRun4J launcher on a separate thread (i.e. the service control thread). This method should modify the state of the application based on the request type passed in. In the example we just modify the shutdown flag.

The getName and getDescription methods are called when the service is registered. These values appear in the service viewer.

The example service simply logs to the windows event log every minute.