Twitter Backup Utility

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.

If you run it without command line arguments you get:

Twitter Backup v0.1.0 @winrun4j

A backup utility for Twitter statuses.

TwitterBackup [-user <user>|-search <search>] -outdir <backup_dir> 
    [-limit #hours|day|week|month|year]

The -user option is simply your twitter user id.

The -search option is a search query (you probably want to put “quotes” around it).

The -outdir option is the directory you want the statuses saved into.

The -limit option sets a time/date limit on the history, so “day” only loads statuses for the last 24 hours. The #hours is a number of hours (e.g. -limit 4 only saves statuses from the last 4 hours).

Some examples:

TwitterBackup -user twitter -outdir C:/TEMP -limit 12

This will save the “twitter” user’s statuses from the last 12 hours to the directory C:/TEMP.

TwitterBackup -search "cool filter:links" -outdir C:/TEMP -limit day

This will save all search results for “cool filter:links” for the last 24 hours to the directory C:/TEMP.

The utility is also incremental so you can run it over and over again and it will only grab new statuses.

It is designed to be run as a scheduled task (e.g. setup a schedule task to run every week and use the -limit week option).

Each twitter status is saved into a separate file using the unique status id provided by twitter. It simply contains the RSS item XML.

You can download TwitterBackup here

Note that Twitter has limits on how much you can download at one time and how far back in time you can go.

BTW The utility should work as specified but the author accepts no responsibilities is something screws up. Use at your own risk.


Launcher File Double-Click in Explorer

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.

The following registry script updates the appropriate entries:

Windows Registry Editor Version 5.00




@="WinRun4J Launcher Configuration"




@="F:\\Development\\tools\\WinRun4J.exe --WinRun4J:ExecuteINI %1"

This assumes that you have the latest version of the launcher saved into F:/Development/tools – if not just change the above entries to point to your folder.

The following screenshot shows a bunch of launcher files:

Now you can create any launch configuration and give it a .winrun4j extension and then double-click to launch.

Caveat: As per usual, make sure you backup your registry before modifying.

New Eclipse Plugin for WinRun4J

The initial version of the Eclipse Plugin for WinRun4J is now available from the WinRun4J SourceForge site.

The Update Site URL is:

The main features of the addin are (as per the website):

  • Launch any Java Application with WinRun4J (via right-click or launch configuration)
  • Export your Java Application as a single Windows Executable (with necessary jars embedded)
  • Provides improved windows integration from Eclipse (eg. JNI access to Registry).

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

Further help on using the plugin is on the plugin website

Create a Windows Service for Java using WinRun4J

The following is a quick tutorial on a creating a windows service in Java using WinRun4J.

The first step is to download WinRun4J.

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:

You can start/stop the service using the service viewer.

The code listing for the service implementation is as follows:

package org.boris.winrun4j.test;

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

 * A basic service.
public class ServiceTest implements Service {
    private int returnCode = 0;
    private volatile boolean shutdown = false;

    public int doRequest(int request) throws ServiceException {
        switch (request) {
            shutdown = true;
        return 0;

    public int getControlsAccepted() {

    public String getName() {
        return "WinRun4J Test Service";

    public String getDescription() {
        return "An example service using WinRun4J.";

    public int main(String[] args) throws ServiceException {
        int count = 0;
        while (!shutdown) {
            try {
            } catch (InterruptedException e) {

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

        return returnCode;

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.

Create a Windows Executable for Java with Embedded JAR Files

The following is a quick tutorial on how to create a single executable for a java application using WinRun4J. We will also give it a splash screen.

To start download WinRun4J.

Now unzip it into any folder, create a new directory called winrun4j and copy:

  • WinRun4J.exe
  • WinRun4J.jar
  • WinRun4JTest.jar
  • WinRun4J.ini
  • SplashScreen.gif
  • RCEDIT.exe

You should now have a folder that looks like this:

Now create a console window and change directory to your winrun4j folder:

Now its time to use RCEDIT to embed the files into the WinRun4J executable. If you run RCEDIT you should see the following output:

WinRun4J Resource Editor v1.0 (

Edits resources in executables (EXE) and dynamic link-libraries (DLL).

RCEDIT   [resource]

  filename      Specifies the filename of the EXE/DLL.
  resource      Specifies the name of the resource to add to the EXE/DLL.
  /I            Set the icon as the default icon for the executable.
  /A            Adds an icon to the EXE/DLL.
  /N            Sets the INI file.
  /J            Adds a JAR file.
  /E            Extracts a JAR file from the EXE/DLL.
  /S            Sets the splash image.
  /H            Adds an HTML file the EXE/DLL.
  /C            Clears all resources from the EXE/DLL.
  /L            Lists the resources in the EXE/DLL.
  /P            Outputs the contents of the INI file in the EXE.


So to embed the JAR files we need to run the following command:

F:\winrun4j>RCEDIT.exe /J WinRun4J.exe WinRun4J.jar


F:\winrun4j>RCEDIT.exe /J WinRun4J.exe WinRun4JTest.jar

Now we need to edit the WinRun4J.ini file to contain the necessary instructions (or in this case remove the unnecessary ones). After editing it should look like this:


Now we are ready to embed this file into the executable:

F:\winrun4j>RCEDIT.exe /N WinRun4J.exe WinRun4J.ini

The last thing we want to do is embed the splash screen:

F:\winrun4j>RCEDIT.exe /S WinRun4J.exe SplashScreen.gif

You should see that the WinRun4J.exe file has increased in size:

You should now be able to double click on the WinRun4J.exe and launch the java application:

To check that there are no magic tricks you can delete the other files (i.e. WinRun4J.jar, WinRun4J.ini, SplashScreen.gif, WinRun4JTest.jar and RCEDIT.exe). You only need the executable.

That’s all folks.

XLLoop 0.2.0 Released

A new release of XLLoop is now available (0.2.0). The new features and changes are:

  • Added popup to client for long running operations (with option to cancel request)
  • Added native Ruby server
  • Added native Python server
  • Added native R server
  • Fixed native Erlang server
  • Buffered streams on java server for improved performance
  • Improvements to reliability on binary protocol
  • Support up to 512 registered functions
  • Reduced xll size by using wcrt

Download at the XLLoop Sourceforge Site.

WinRun4J 0.3.0 Released

A new version of WinRun4J is now available (v0.3.0). The changes and new features are:

  • Added log.overwrite option for log files
  • Fixed log file logging
  • Added process.priority option to set process priority on startup
  • Fixed shutdown bug on service mode
  • Added ability to write text to splash screen
  • Fixes for splash screen loading in 64 bit mode
  • Improved window attributes on splash screen
  • Further improvements to diagnostics

Download at the WinRun4J Sourceforge Site.