February 09, 2010

JSmooth Windows Service with custom JRE

For a customer I needed a solution to launch a standalone Java application as a Windows Service. After evaluating a number of solutions I ended up with JSmooth 0.9.9-7 http://jsmooth.sourceforge.net/ a very nice open source product with nice GUI to guide you through the process.

Because the product of my customer depends on a specific JVM version we decided to bundle our JVM version with the product. JSmooth supports bundling a custom JVM, however when running as a windows service it ignores this setting. It's been a while since the original author responded to forum messages or released a new version, so I decided to jump in the C++ code. I'm nowhere near a C++ expert, but managed to create a simple workaround.

My bugfix (source + skeleton binary) can be downloaded here.

Just drop the winservice.exe file in your JSmooth installation under /skeletons/winservice-wrapper/ and recompile your service EXE. The service logfile should now be populated with messages indicating it's attempting to run your bundled VM and so on.

Enjoy!