jsrvany logo
i n s t a l l a t i o n
 
  1. Check out the requirements. Ensure you have everything you need installed.
  2. Download jsrvany
  3. Unzip the package to your filesystem.
  4. Ensure that you have jvm.dll in your PATH. To do this, go to Start | Settings | Control Panel | System | Environment. Click on Path and add the directory which contains jvm.dll. In my case this is E:\jdk1.2\jre\bin\classic. You may need to reboot for this to take effect.
  5. Change to the directory in which you unzipped jsrvany. In my case, this is E:\projects\jsrvany
  6. Run the installer instsrv.exe to install a default service under a servicename of your own choosing. The full options available are:
    SYNTAX instsrv [options] [arguments]
     where:
            -h             - prints this help message
            -r             - remove a service
            -n serviceName - the name of the service to create/remove
            -d displayName - the display name of the service to create/remove
            -c className   - the name of the java class to run
            -i imagePath   - the full path to jsrvany.exe
            -p classPath   - additional parameters to the classpath
            -a arg         - an argument to the java class to be executed
    
    
    A default ServiceControlListener class is provided for testing. The classname is net.sourceforge.jsrvany.test.SimpleServerImplementation.Use this on the initial install to ensure that your basic setup is correct. A typical install command would be:
    instsrv -n JSrvAnyTest -c net.sourceforge.jsrvany.test.SimpleServerImplementation
         -i E:\projects\jsrvany\jsrvany.exe -p E:\projects\jsrvany\jsrvany.jar
    
    Modify the paths given above to suit your own setup and use a service name of your own. The -d option allows you to specify a Display Service Name that will appear in the Service Control Panel. If you do not use this, the name that is displayed will be the servicename specified in the -n option, JSrvAnyTest in the example above.

    You should see a message like :

    E:\projects\jsrvany\jsrvany.exe installed successfully
    
  7. Run your test service from the Service Control Panel: Start | Settings | Control Panel | Services Select the service you have just installed and click Start.
  8. Test your default installation by running telnet 127.0.0.1 23. The default class net.sourceforge.jsrvany.test.SimpleServerImplementation is a simple java server that listens of the telnet port (23) and will echo back anything you enter. It will also print the events it receives from the control manager back to your telnet window. Once connected, ensure that it echos anything you enter at the keyboard. From the service control panel, click pause. You should see something like this in your telnet window.

  9. Click the stop button in the service control panel. The service will stop and your telnet session should be lost.
  10. At this point the basic install is working. You now need to modify the system to run your own class, with your own classpath and arguments to your application. Modify your service by editing the Service registry entries as follows:
    Run regedt32
    Select HKEY_LOCAL_MACHINE on Local Machine
    Select System | Current Control Set | Services | <your service name> | Parameters where your service name is the service name your chose after the -n option above.
    The three values defined there, className, classArgs and JVMOptions, can be modified by double-clicking on them and editing the dialog box.
    The className parameter is the fully-qualified class name of the class implementing ServiceControlListener and is a single String.
    The classArgs parameter is all the arguments to your class, one per line. Note if you have an argument pair such as name=value it needs to be treated as a single argument and entered on one line.
    The JVMOptions parameter is a multi-line string that allows you to specify additional run-time parameters to the JVM, one per line. The existing line -Djava.class.path= is the user-defined classpath. Any classes or packages you need to run your application must be entered here. Other parameters can be specified one per line, for example:
    -Xms16m
    -Xmx16m
    -Djava.compiler=NONE
    -Djava.class.path=E:/projects/jsrvany/classes;E:/classes/jserv/jserv.jar;E:/classes/jsdk/jsdk.jar
    
  11. Exit the registry editor and start your service from the service control panel.
t r o u b l e s h o o t i n g
Troubleshooting information is now here.