Java application as a Windows Service  

Posted by Krishna Chowdary



From last 2 days I was busy in wrapping a Java application in a Windows Service. Tried many open source tools like Java Service Wrapper, J2Exe, JSL. But culdn't find a solution. Finally i found JavaService.Exe in one of the blogs. This is very easy to configure. After trying many tools, I felt this is the best tool to wrap Java application in a Windows Service.

Software and documentation can be found in 
http://forge.objectweb.org/projects/javaservice/

JavaService contains a Windows executable service that allows you to launch any Java application in a specified environment.
Copy JavaService.exe to your project and rename it to match whatever you want your service to be named (this is what you will see in the Windows Task Manager).

Next, you need to create a class to execute. JavaService can execute any application with a main() method, or you can specify a method to execute when the service starts. It must return void and accept as a parameter a String[].

Finally, you use the JavaService.exe file to install a Windows NT Service. This is accomplished by passing it a "-install" command line parameter followed by a set of additional parameters



Cygwin  

Posted by Krishna Chowdary


Today i got a requirement, where i have to run a linux apps in windows. Thought of going for a linux OS, but googled sometime to find a utility to do that. I found Cygwin which is a pretty good tool.It provides Linux-like environment for Windows. 
It consists of two parts:
  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools which provide Linux look and feel.
These tools ports popular GNU development tools for Microsoft Windows.
With these tools installed, it is possible to write Win32 console or GUI applications that make use of the standard Microsoft Win32 API and/or the Cygwin API. As a result, it is possible to easily port many significant Unix programs without the need for extensive changes to the source code