Error message: Error J0051: Undefined Package 'com.ms.service'

SYMPTOMS

When you try to compile a Java application as an NT service that uses classes in the com.ms.service class, you may receive the following Java compiler error message:
J0051: Undefined Package 'com.ms.service'

CAUSE

The com.ms.service package is not part of the default Microsoft virtual machine (Microsoft VM) installation. Therefore, the compiler cannot locate the com.ms.service package when the compiler scans the default CLASSPATH.

RESOLUTION

If you are using Visual J++ 6.0 to build your NT service application, follow these steps to add the Service.zip package file to the compilation CLASSPATH:

  1. On the Project menu, click Properties.
  2. In the Project Properties dialog box, click the CLASSPATH tab.
  3. Click New, and then type the fully-qualified path name for Service.zip.

MORE INFORMATION

The com.ms.service package is part of the Microsoft Software Development Kit (SDK) for Java installation. The com.ms.service package can be found in the Jntsvc subdirectory of the SDK installation in the Service.zip file. The Service.zip file must be included in the CLASSPATH for applications that use the Java .class files in the com.ms.service package. The Jntsvc folder also contains a Makefile for building a sample service. The sample service illustrates one way to include the Service.zip package to the CLASSPATH for a command-line compile that uses the Microsoft Java compiler (Jvc.exe). The -cp:p service.zip command-line compiler option that appears in the Makefile prepends the Service.zip package file to the default CLASSPATH at compilation time.

The information in this article pertains to the J0051 compilation error that you receive when you reference the com.ms.service package. The execution of the code with a com.ms.service package is a separate topic. For more information about code execution with a com.ms.service package, see the Readme.txt file in the Program Files\Microsoft SDK for Java 4.0\jntsvc folder.

REFERENCES

To download the latest version of Microsoft SDK for Java, see the following Microsoft Web site:
For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:
Propiedades

Id. de artículo: 320722 - Última revisión: 14 feb. 2017 - Revisión: 1

Microsoft Software Development Kit for Java 4.0, Microsoft Visual J++ 6.0 Edición estándar

Comentarios