Contents
Overview
Build Instructions
File Descriptions
Overview
This documentation applies to building this product
using Visual C++ 6.0. In addition, you must have the lib file and header
files for a JNI 1.2 compliant Java Virtual Machine, such as Sun's Java
2 SDK version 1.2 or 1.3. This documentation assumes you are using a version
of the Sun Java 2 SDK.
The result of building this product is a Win32 executable
called JavaService.exe.
Build Instructions
- The first step is to configure Visual C++ to be able to find the JNI
lib file and header files.
- Go to 'Tools->Options' on the menu.
- Go to the 'Directories' tab on the dialog.
- Choose 'Show directories for: Include Files'.
- Add the directory '{JDK_HOME}\INCLUDE' to the list.
- Add the directory '{JDK_HOME}\INCLUDE\WIN32' to the list.
- Choose 'Show directories for: Library Files'.
- Add the directory '{JDK_HOME}\INCLUDE\LIB' to the list.
Visual C++ should now be properly configured to
compile binaries using JNI.
- Either open the project included with the distribution or create or
new one. If you are creating a new project, be sure to choose 'Win32
Console Application' as the project type, and choose 'An Empty Project'
when asked what files to automatically generate.
- Make sure the project contains the following files:
- Source Files
- JavaInterface.cpp
- ServiceInterface.cpp
- Header Files
- JavaInterface.h
- Messages.h
- Resource Files
- Messages.mc (note: see file description for build instructions
if you change this file)
- Messages.res
- You should now be able to build the JavaService.exe file by going
to 'Build->Build JavaService.exe' on the menu.
File Descriptions
ServiceInterface.cpp
This file contains the code to interface with the NT service subsystem.
JavaInterface.cpp
This file contains the code to create and interface with the Java Virtual
Machine.
Messages.mc
This file contains the text version of the message resources that get
compiled into the final binary. These resources are used by the Event
Viewer to display formatted messages that are logged to the NT event log.
Messages should be formatted like the following example:
MessageId=0x0000
Severity=Informational
Facility=Application
SymbolicName=EVENT_IDENTIFIER
Language=English
Example message %1 with two parameters %2.
.
If the Messages.mc file has been changed since it
was last compiled, it must be manually recompiled before the final binary
is built. Use the following steps to compile the Messages.mc file:
- Open a command prompt and run the 'VCVARS32.BAT'
file that is installed with Visual C.
- Move to the directory containing the JavaService source code.
- Run the command 'mc Messages.mc'
to generate the files MSG00001.bin, Messages.h, and Messages.rc.
- Run the command 'rc -r Messages.rc'
to generate the file Messages.res.
- Make sure that the files Messages.h and Messages.res are included
in the project
Messages.h
This file contains the identifiers used when logging messages to the
event log. It is automatically generated from the Messages.mc file.
Messages.rc
This file is a resource script for the message resources. It is automatically
generated from the Messages.mc file.
MSG00001.bin
This file contains the binary version of the message resources. It is
automatically generated from the Messages.mc file.
Messages.res
This file contains the compiled version of the message resources to be
included in the final binary. It is automatically generated from the Messages.rc
file.
|