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.
We use the Java Service Wrapper by Tanuki Sofware (http://wrapper.tanukisoftware.org/).ReplyDelete
Did you evaluate this and if so, why wasn't it a good solution?
I did evaluate JSW, and it's forked OpenSource version http://yajsw.sourceforge.net/. The main thing that I disliked about it is the fact that it requires a lot of dependent files, EXE, DLL, BAT, etc...ReplyDelete
JSmooth on the other hand is entirely self-contained. Your service's EXE file is a single EXE file with your application JAR embedded. No other scripts or DLL's are necessary, this is a lot cleaner and it's easier to "patch", just overwrite a single EXE file and you're done and less things can go wrong in case the user started messing around in those files.
At some point in the future I know that we will have to look for another service wrapper solution as JSmooth doesn't support 64bit Windows, which we don't have to support at the moment.
I agreed with Jo Voordeckers. But i got error code 1067 once i tried to start window service. Any idea about this issue? Thanks a lot. 11596803(at)163.com.ReplyDelete
I'am new working with JSmooth 0.9.9-7, and I have a problem with my window service created. My window service don't found a JVM.
the SO is windows XP pro and I have configured the next environment variables:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;"C:\Archivos de programa\Java\jre6\bin";"C:\Archivos de programa\Java\jre6\bin\client"
JAVA_HOME="C:\Archivos de programa\Java\jdk1.6.0_22"
JRE_PATH="C:\Archivos de programa\Java\jre6"
Can you give me some idea how fix the problem?
Your fix has solved a massive problem I was having with 64 bit machines with 64 bit jre. As jsmooth doesn't support 64 bit jre this was a great way to bundle a 32 bit version with my .exe.ReplyDelete
Thanks for saving my day!
Thanks it saved my day!.... Cheers....ReplyDelete