jvmi.jpg (2468 bytes)

JVMI2 - The Java/NT Services Utility

NT4/2000 Version 2 - April 14, 2001

Designed for installing, removing and running Java 2 applications as NT services.

by Bill Giel / KC Multimedia and Design Group

Free Evaluation Download - JVMI2 is available at no cost for testing and evaluation. This version displays an "Evaluation Only" message that is not displayed in the retail version. Otherwise, this is the exact same software as the licensed version and comes with ready-to-run examples and Java source code (for the examples).

Single user versions will be available for online purchasing soon. Bulk licensing is also available. Please direct inquiries to bgiel@kcmultimedia.com.

What's New
  • Optionally self-installs or removes pure Java app's as NT services from the command line. JVMI2 eliminates the need for third-party service installers for Java 2 applications. Install as many Java apps as services as needed, name them any way you like. JVMI2 also logs installs/removes for your records.
  • Service installations are configured using simple, readable XML text files. A single file can execute multiple service installations.
  • Optionally redirect Java's System.out and System.err to a log file.
  • Optionally set a working directory.
  • Optionally set service dependencies.
  • Familiar command line syntax. Arguments for your app and the JVM are expressed in way that is compatible with java.exe.
  • Trap logoff events if JDK 1.3.0_x is detected.
  • Install in any directory, JVMI2 no longer has to be installed in the JRE folder.
  • Embedded spaces in path names and other arguments are supported.
  • Improved output and event-logging, to help diagnose troublesome java applications as services.
  • Reusable Java source code demonstrating a simple way to receive service stop events from NT in your Java application with no JNI code.

and...

  • Still can be used as a console JVM invoker, implementing a subset of java.exe's command line syntax (compatible with the original JVMI)

 

JVMI2 provides everything needed for running pure Java applications as NT services. In addition to its original role as a simple alternative to java.exe for trapping logoff events with JDK 1.3.0, it provides a great deal of new functionality.

  • Command line installation or removal of your Java applications as NT services
  • Easy configuration of service and display names, working directory, redirection of System.out and System.err to a log file, service dependencies and arguments to the JVM and your application, using XML formatted text files.
  • Automatically traps logoff events if using JDK 1.3.0
  • Provides a simple mechanism for pure Java applications to receive stop events from NT by implementing the provided SCMEventManager Java code.
  • Improved event-logging and error reporting to assist in debugging troublesome installations.

Using JVMI2

Unpack the distribution zip file to your destination of choice.

Using JVMI2 as a Java launcher from the console

Using JVMI2 to install/remove NT Services

Using JVMI2 as a Java launcher from the console

If you are using Java 1.3.0, you can use jvmi2.exe instead of java.exe  to run Java applications as NT services with generic utilities such as ServiceInstaller, srvany, Idetix Invoker and others. (JVMI2 will trap the logoff events that normally cause java.exe to end with Java 1.3.0. This has been addressed in later Java versions.)

Running jvmi2 as a console application can also help confirm proper functioning with your application,  in preparation for installing your application as a service.

Jvmi2's console syntax is similar to java.exe:
jvmi2.exe [options] class [arguments...]

Options

-cp classpath
Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by semicolons (;). Any paths specified here will completely replace a CLASSPATH environment string, if any.
-Dproperty=value
Set a system property value, such as java.rmi.codebase. These arguments are passed directly to the JVM. A java.class.path specified here will completely replace a CLASSPATH environment string, if any.
-Xargument
Sets non-standard options (see java.exe documentation) to be passed directly to the JVM.

Important Notes concerning CLASSPATH

A classpath stated using -cp classpath will take precedence over any classpath stated using -Djava.class.path=classpath

Using JVMI2 to install/remove NT Services

To install your app as an NT service, first create an installation file that contains the information needed. Jvmi2's installation files are formatted using XML tags. An example is shown below:

<INSTALL>
<SERVICE>

<SERVICE_NAME>JVMIDemo</SERVICE_NAME>
<DISPLAY_NAME>
JVMI Demo</DISPLAY_NAME>
<STARTUP_TYPE>
AUTO</STARTUP_TYPE>
<ARG>
-Djava.class.path=%CWD%\demo.jar</ARG>
<ARG>
com/kcmultimedia/jvmi2/Test</ARG>
<LOGFILE>
jvmi.out</LOGFILE>
<SCM_EVENT_MGR>
com/kcmultimedia/jvmi2/SCMEventManager</SCM_EVENT_MGR>
<WRKDIR>
%CWD%</WRKDIR>
</SERVICE>
</INSTALL>

Note in the above that the first non-JVM argument (set off by <ARG>...</ARG> tags) is the main class of the Java application. Also note the use of '/' rather than '.' when specifying class names. Finally, note the use of %CWD% which expands to the current working directory

The command

jvmi2 -f filename

where filename is the path of the XML installation file, will install your service.

To remove a service, use

jvmi2 -r servicename

where servicename is the registry Service Name (not the Display Name) of the service to be removed.

Jvmi2 keeps a log of services that it installs or removes in its installation root directory for reference purposes

 

 

Copyright 1999 by Rocky Fikki & Bill Giel / KC Multimedia and Design Group, Inc.
All Rights Reserved.