Working with MS VM
 
 

Tools    PreviousToolsNext
Tools Quick Reference     Previous Tools Next

 


Tools Quick Reference

This section defines the command-line syntax and operation of the Java tools included with the Microsoft SDK for Java.

Microsoft AppletViewer (appletviewer)

appletviewer url | filename

Runs a Java applet.

ParameterDescription
url Specifies the address of an HTML file containing an APPLET tag that defines the Java applet to run.
filename Names the HTML file containing an APPLET tag that defines the Java applet to run.

AWT Conversion Wizard (awt2afc)

The awt2afc utility is a web-based application that parses Java source code and determines what changes are necessary to convert the source to use the Application Foundation Classes (AFC). The utility only adds source code comment-style suggestions to an existing source file. It does not handle the conversion process.

The awt2afc utility has two functions. It determines and lists the classes that need to be changed in an existing source file in order for the source to run with AFC. It can also add comments directly to a source file at each declaration or instantiation of a class that could be replaced in source.

The list of classes appears below the applet and is generated every time you select Go. The list includes links to pages that suggest changes for particular classes and a link to a page that lists all the classes that do not change when using AFC. Select Show All Conversions to list all the classes and their suggested AFC conversions.

The Add Comments to Source check button controls whether awt2afc inserts suggestions directly into a parsed source file. The comments are inserted at each instantiation and declaration of an AWT class, but not at each method. See the help files included in the generated list for specific method conversions for a particular class. Each comment follows the following format:

//TODO: Suggestion (AWT2AFC)

This format makes it easy to do a global search for suggested code changes in a source file.

The Create Backup option saves the original parsed file under a .bak suffix (MySource.java becomes MySource.java.bak). Only one backup file is made, and it is overwritten if a file is parsed mutiple times.

Cabinet File Archiving Utility (cabarc)

cabarc [options] [command] filename

Handles the archiving of multiple files in a compressed format.

For more information, see Creating and Using Cabinet Files for Java Applets and Libraries.

ParameterDescription
options The n command can take a combination of the following options:
/p Preserves the directory name in the cabinet file when used with the n command and uses that directory information when used with the x command. By default, only the filename component is stored or extracted.
/P path Strips the path entered from any paths preserved in the cabinet file when using the p option.
/r Archives files recursively in all subdirectories.
/s size Reserves space size in the cabinet file for a code signature. The size parameter should be 6144 bytes.
/i cabinet ID Includes a specified 16-bit cabinet identifier for application use.
/m compression type Sets the compression type. compression type can be either MSZIP or NONE. By default, MSZIP is used as the compression type.
@file file Takes the list of files to be added to the cabinet file from a specified text file.
command Can be one of the following commands:
n filename Creates a new cabinet file with a name specified by filename. See the previous options for a description of the options available with this command.
l filename Lists the contents of the cabinet file specified by filename. Cabarc also displays any cabinet identifier in the cabinet file (see the previous option /s) and the following file information: size, date, time, and attributes.
x Extracts files from the cabinet file specified by filename. See the previous /p option for extracting files into the original directory.
filename Specifies a list of files to be archived. Wildcards (such as *.java) are accepted. All files are placed in a single folder, unless a plus sign (+) is placed in the list to delimit folders. For example, the following command would create two folders.
cabarc /n n mycab.cab test.* + *.java 

Remarks:

Use this utility to create new cabinet files or to list or extract files from existing cabinet files.

Software Publisher Certificate Test Utility (cert2spc)

cert2spc cert1.cer cert2.cer...certN.cer outputSPCfile.spc

Creates a Software Publisher's Certificate (SPC) from one or multiple X.509 certificates. This utility, like makecert, is for test purposes only. A valid SPC is obtained from a Certification Authority (CA).

ParameterDescription
certN.cer Specifies the name of an X.509 certificate to include in the SPC file.
outputSPCfile.spc Specifies the name of the PKCS #7 object that contains the X.509 certificates.

Certificate Manager (certmgr)

certmgr [options] [/s[/r RegistryLocation]] Storename

certmgr /add [options] [/s[/r RegistryLocation]] SourceStore [/s[/r RegistryLocation]] DestinationStore

certmgr /delete [options] [/s[/r RegistryLocation]] SourceStore [/s[/r RegistryLocation]] DestinationStore

The certmgr utility manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs). The certmgr has three basic functions, as follows:

  • Displays certificates, CTLs, and CRLs. In this capacity, it replaces the dumpcert utility.
  • Adds certificates, CTLs, and CRLs, from one certificate store to another.
  • Deletes certificates, CTLs, and CRLs, from a certificate store.

Certmgr works with two kinds of certificate stores, StoreFile and system store. It is not necessary to specify the type of store file; certmgr can identify the StoreFile type and perform the appropriate operations.

ParameterDescription
/add Adds certificates from one certificate store to another. When this option is invoked, the following options may also be used.
/c Adds certificates.
/CTL Adds certificate trust lists (CTLs).
/CRL Adds certificate revocation lists (CRLs).
/all Adds all the entries.
/7 Saves the destination store as a PKCS#7.
/n commonName String Specifies the common name of the certificate to add. This option can only be used with certificates; it cannot be used with CTLs or CRLs.
/sha1 sha1Hash The SHA1 hash of the certificate, CTL, or CRL to add.
/delete Deletes certificates. When this option is invoked, the following options may also be used.
/c Deletes certificates.
/CTL Deletes certificate trust lists (CTLs).
/CRL Deletes certificate revocation lists (CRLs).
/all Deletes all the entries.
/7 Saves the destination store as a PKCS#7.
/n commonName String Specifies the common name of the certificate to delete. This option can only be used with certificates; it cannot be used with CTLs or CRLs.
/sha1 sha1Hash The SHA1 hash of the certificate, CTL, or CRL to delete.
options The certmgr utility also accepts the following options.
/s Indicates the store is a system store. If this option is not set, the store is a StoreFile.
/r Registry location Identifies the registry location of the system certificate store. This option is considered only if the /s option is set. Registry location must be either currentUser (indicating that the certificate store is under the HKEY_CURRENT_USER key [the default]) or localMachine (indicating that the store is under HKEY_LOCAL_MACHINE).
/? Displays Help for the utility.
/v Verbose mode. Displays detailed information about certificates (CTLs and CRLs). Using the certmgr tool with the /v option performs the same function as the dumpcert tool. This option is not used with the /add or the /delete options.
/c Displays certificates when used without the /add or the /delete options.
/CTL Displays certificate trust lists when used without the /add or /delete option.
/CRL Displays certificate revocation lists when used without the /add or /delete option.
/y storeProviderType Specifies the store provider type.
/f dwFlags Specifies the store open flag. This is the dwFlags parameter passed to CertOpenStore. The default value is CERT_SYSTEM_STORE_CURRENT_USER. This option is considered only if the /y option is used.
/e encodingType Specifies the certificate encoding type.

Remarks:

The following examples show some of the certmgr utility's different functions.

View a system store called my store.

C:\..\>certmgr /s my

Add all the certificates in a file called myfile.ext to a new file called newFile.ext.

C:\..\>certmgr /add /all /c myFile.ext newFile.ext

Move a certificate with a common name myCert in my system store to a file called newCert.cer.

C:\..\>certmgr /add /c /n myCert /s my newCert.cer

Delete all the CTLs in my system store and save the resulting store to a file called newStore.str.

C:\..\>certmgr /del /all /ctl /s my newStore.str

Java Signature Verification (chkjava)

chkjava [options] filename

Allows users to view security information placed in a cabinet file by signcode with the JavaSign DLL. The utility checks the validity of a signature and displays the certificate information and security permissions contained in the file on the console output.

If the signing information is valid, and the signature contains Microsoft® ActiveX® permissions, the utility displays a message that indicates the file is signed with ActiveX permissions.

ParameterDescription
options The chkjava utility supports the following options:
/q Suppresses all message boxes (quiet mode). If you do not specify the /q switch, the utility displays a dialog box that shows all the permissions and signature information.
/o outputfile Specifies that permissions read from the signed cabinet file will be written to the output file in an .INI format. The format of the output file is the same as the input file for JavaSign.dll.
filename Specifies the name of the file to verify Java permissions for.

Remarks:

The following output is an example showing the format used 
when the signed file is successfully read and the information 
is dumped to the screen.

   Filename:         <filename>
   Program Name:     <OpusName>
   Further Info:     <Info Location>

   Published by:     <Publisher Name>
   Publisher type:   (Commercial | Individual)
   Verified by:      <Agency Name>

   Trust Level:      (High | Medium | Low | Custom)
   [<permission info>]

If the /o flag is specified, the permission information will be written to a text file suitable for input as the information file in signcode using the JavaSign.dll.

The following example shows various sample command lines using the chkjava utility, and their results.

C:\..\>chkjava my.cab 
   Displays a dialog box with signature information.

C:\..\>chkjava /o test.ini my.cab
   Displays a dialog box and outputs the .INI file as test.ini.

C:\..\>chkjava /o test.ini /q my.cab 
   Only outputs to .INI.

C:\..\>chkjava /q my.cab
   Displays only basic information.

Certificate File Validation Utility (chktrust)

chktrust [options] filename

Checks the validity of a file by extracting the PKCS #7 data object and its X.509 certificates, and compares a hash with the signed hash in the PKCS object. If the hash is equivalent to the signed hash code, the utility verifies that the signer's X.509 certificate is traceable back to the root certificate and that the correct root key was used.

ParameterDescription
options The chktrust utility accepts the following options.
/c A cabinet file (for Internet Explorer 3.02 UPD only).
/i A PE image file. Includes .exe, .dll, and .ocx files (for Microsoft® Internet Explorer 3.02 only).
/n No user interface in a "bad trust" case (for Internet Explorer 3.02 only).
/s Software publishing trust provider (default, for Internet Explorer 4.0 only).
/q Software publishing trust provider, but no user interface in a "bad trust" case (for Internet Explorer 4.0 only).
/w Windows compatibility trust provider.
/cf Catalog file and path.
/cmt Catalog member tag.
/? Displays options.
filename The signed file to check trust on.

Remarks:

Versions of chktrust that are older than the one released with Internet Explorer 3.02 can't validate files signed with later Microsoft® Authenticode™ releases.

Class File Contents Viewer (classvue)

classvue [options] [drive:][path] classname [>outputfile]

Displays the contents of a Java class in a readable format.

ParameterDescription
options Can be a combination of the following:
/min Displays only D1 level information.
/ltd Displays only D1, D2, and D3 level information (see the following for definition).
/v Provides a verbose display of the .class file.
/cpno Suppresses the display of constant pooling.
/tables Displays many of the items in table form.
/ivmal Generates informal Virtual Machine Assembly Language.
/CVue Displays output sent to a file named by the package and class with the extension .cvue.
/q Suppresses the Microsoft copyright banner (quiet mode).
/? Displays the list of available options.
/D? Displays the list of information levels.
/readme Displays descriptions of ActiveX® terms and abbreviations displayed by classvue, and known issues relating to the utility.
classname Specifies the name of a Java .class file. This must specify a drive or a path (or both) of the file if it is not in the current drive or directory.

Remarks:

The classvue utility writes information to the standard output, listing a class overview and the offsets, sizes, types, and values of the constant pool, fields, methods, and attributes belonging to the class.

The ClassVue utility generates seven description levels. By default, all levels are displayed. You can use the /min, /ltd, or /cpno options to alter the levels displayed. The description levels are as follows:
D1 Overview information
D2 Methods, fields, and classes
D3 Root data structures
D4 Constant pool
D5 Fields pool
D6 Methods pool
D7 Attributes pool

Example:

The following command line generates information about a class named "Hello."

classvue \SDK\Samples\Jexegen\Hello\Test\Hello.class

Package Manager Archive Utility (clspack)

clspack [options] [filename]

The clspack windows-based utility enables you to write the contents of packages that are installed with the package manager to a .zip file archive. This avoids constant downloads of the classr.exe self-extracting archive; you can now create your own archive from the contents of the Java Language Package Manager (JPM).

The utility reads from a text file that contains the list of packages to write to the .zip file archive. This enables you to archive only packages that you need. The following example shows how you can create a .zip file using the contents of a text file. The clspack utility is case insensitive, so packages like com.ms.activeX and com.ms.util.InputMethod are parsed as com.ms.activex, and com.ms.util.inputmethod, respectively. The text file lists the following packages:

java.io
com.ms.util
com.ms.util.cab
com.ms.util.InputMethod

The clspack utility automatically skips non-system classes (including when the -dump or -auto options are used from a command line). However, the utility will export any class if it is included in the text file that lists the packages.

ParameterDescription
options In addition to its windows-based operation, the clspack utility currently accepts the following command line options:
-auto Creates a single Classes.zip and adds it to your classpath, if not present. It contains all system classes stored in the JPM. The Microsoft compiler for Java (jvc) checks this location by default, so there is no need to set your class path environment variable. If you use another Java compiler that does not check this location, set your class path variable as follows:
C:\>set CLASSPATH=%WINDIR%\java\classes\classes.zip

Use the javasrc utility to extract the contents of classes.zip.

-dump outputfile Writes all the system packages currently installed in the package manager to the specified output file.
-nonsystem Builds a Microsoft VJ++ 1.1 compatible .zip archive for non-system classes (java\trustlib\nonsystm.zip). This archive is built separately from classes.zip and is added to the trusted classpath.

A .zip file that contains the contents of system packages stored in the package manager is created first by using the -dump option to create a text file that lists the various packages. Run the clspack utility with this same text file as the source package list:


clspack -dump tmpfile.txt
clspack MyJavaClasses.zip tmpfile.txt

Custom Permission Editor (cprmedit)

cprmedit

Edits Java permissions for security zones recognized by Microsoft® Internet Explorer 4.0 and later.

The cprmedit tool enables you to edit Java permissions for specific security zones using a graphical user interface. The permissions set by cprmedit are recognized by Internet Explorer 4.0 and later. The user interface presented by the cprmedit tool is similar to the dialog boxes in Internet Explorer 4.01 that allow administrators to set security options.

To run the Custom Permission Editor, type cprmedit on the command line. The Custom Permission Editor dialog box will appear. To edit the permissions for a particular zone, choose one of the zones listed in the drop-down list box. For each zone, there are three sets of permissions that you can edit.

Permission Set Description
Unsigned Permissions Permissions that are granted to unsigned content.
Trusted Signed Permissions Permissions (requested by signed content) that do not require user approval.
Untrusted Signed Permissions Permissions (requested by signed content) that require user approval or permissions that are absolutely denied.

You can choose to add all permissions to a permission set or you can edit specific permissions in the set. If you need more information about how to edit a particular permission, you can get context-sensitive help by pressing F1 after you have selected a check box or text box.

For more detailed information about how to use the Custom Permission Editor, see the Using the Custom Permission Editor article.

Distribution Unit Archiving Utility (dubuild)

dubuild filename.cab [drive:][path] [options]

Writes an Open Software Distribution (OSD) file and places it in a cabinet file archive with any specified contents. The dubuild utility is similar to cabarc, but uses the OSD manifest instead of .inf files. Dubuild and Distribution Units are only used by Internet Explorer 4.0.

For more information, see Using DUBuild.

ParameterDescription
filename.cab Specifies the Distribution Unit filename.
path Specifies the source path to the files that are included in the archive.
options Can be a combination of the following:
/H or /? Displays the list of available options.
/D "friendlyname" Sets the Distribution Unit's friendly name.
/P oldDUName.cab Specifies a previous Distribution Unit filename used in creating Split DUs.
/M Creates a multi-cab Distribution Unit.
/I pattern Includes files that match the specified pattern.
/X pattern Excludes files that match the specified pattern.
/N "namespace" Sets the DU's namespace.
/B BeanInfo Used to register ActiveX controls as JavaBeans.
/S pattern Marks packages as system packages.
/V version Use default version numbers for VD, VP, and VN.
/VD version Sets the minimum version number for the Distribution Unit.
/VP version Sets the minimum version number for the packages included in the DU.
/VN version Sets the version number for new packages included in the DU (used in creating Split DUs).
/Z Builds DUs with MSZIP compression for Internet Explorer 3 compatibility. By default, LZX compression is used.

Remarks:

The dubuild utility creates Distribution Units, Split Distribution Units and registers ActiveX controls as Beans. Any command-line parameters may be specified from a file by providing that file's name as @file.

The {BeanInfo} syntax is as follows:

/B package,class,regmode,progid,guid,iconfile,flags,tlbguid,
   tlbfile,bitmap32

The arguments must be in this order and may not have any spaces, and there cannot be any spaces between comma separators if any parameters are excluded. For example, if you do not want to include an iconfile, you would use the following syntax:

C:\..\>dubuild /B pkg,cls,regmd,pid,guid,,flags,tlbguid,tlbfile,bit32

Simple Bean identification can be done by supplying only the package name and the class filename. ActiveX registration requires regmode and at least the guid argument, as well.

Simple Registration
C:\..\>dubuild /B com.foo.net,Connect.class

Full Registration
C:\..\>dubuild /B com.foo.net,Connect.class,ActiveX,
      FooNetConnector,{FCOCF5C5-06DA-11d1-8F36-00C04FD8FF5E},
      com\foo\net\Connect.ico,1,
      {FCOCF5C6-06DA-11d1-8F36-00C04FD8FF5E},
      com\net\foo\Connect.tlb,
      com\net\foo\Connect.bmp

GUID Generator (guidgen)

Generates a globally unique identifier (GUID).

Remarks:

The guidgen utility displays a dialog box that you specify the format of the GUID definition with. You can then save the definition to the Clipboard and paste it into your source file. For more information about using this utility, press F1 in the guidgen dialog box to open a Help window.

Java/ActiveX Integration Utility (jactivex)

jactivex [options] filename

Hosts automation-enabled ActiveX Controls in Java and generates Java source from type libraries.

For more information, see Using Jactivex's JavaTLB Compatibility Support and Using Jactivex to Create a User-Defined Type for Java/COM Marshaling.

The default operation is to create a JavaBean wrapper for an ActiveX Control. Jactivex creates IDispatch wrappers for an ActiveX object using code and helper objects that are similar to JavaBeans to add and remove listeners for the ActiveX event interfaces.

The jactivex utility also inherits all the capabilities of the jcom utility (released in previous versions of the Microsoft SDK for Java) to generate Java source files from type libraries. These operations are performed with an additional switch, /javatlb, but are otherwise the same as with the jcom utility.

ParameterDescription
options
/javatlb Accesses Component Object Model (COM) integration features not available in default mode (generates Java source from type libraries). To access lower-level COM integration features with the jactivex utility, use the /javatlb switch and any combination of the following switches:

/b Follows JavaBeans design pattern for properties.
/cj Creates template for implementing coclass in Java.
/d directory Sets the output directory for concerted controls. By default, the directory is set as (default=%WINDIR%\java\trustlib).
/e Excludes the output for typelibs not on command line.
/G3.1 Targets 3.1 Microsoft virtual machine (default=/G4).
/G4 Targets 4.0 Microsoft virtual machine (default=/G4)
/j Generates undecorated Java source.
/l list file Creates a list of all output files (default=none).
/n jnffile Specifies a JNF file (default=none).
/nologo Suppresses the Microsoft copyright message.
/p package name Sets the root package. By default, the package name is not set.
/p:b- Indicates that the type library name is not included in the package.
/r Registers type libraries.
/w Disables all warnings.
/WX Elevates warnings to error status.
/x2 Represents 2-byte integers as a char.
/xc Ignores coclasses in typelib.
/xd- Do not generate Default interfaces.
/xh Do not map S_FALSE to ComSuccessException.
/X:m- Disables auto-marshaling. By default, auto-marshaling is enabled.
/xi Exposes default interface methods directly on coclass.
/? Displays command-line help and usage.

filename When run in default mode, this is the name of the ActiveX file to create a wrapper for.

The following command creates a JavaBean wrapper for an ActiveX control:

jactivex mscal.ocx

Otherwise, if you use the /javatlb switch and any other options, this is the name of the type library that the Java source will be generated from.

For more information on jactivex command-line options that relate to Java/COM integration, see Jactivex Extended Command-Line Options.

Remarks:

Warning Do not use Microsoft® Visual J++™ compilers earlier than version 1.02.3920 to compile the files generated by this utility.

Java Register (version 3.0 pre-release 2) (javareg)

javareg [options]

Registers Java classes as COM components in the Microsoft® Windows® Registry.

For more information about using this utility, see Using JavaReg.

ParameterDescription
options
/? Provides command-line Help and usage information.
/register Registers the command-line class parameter with the specified class identifier in classid. You can also use /register with /class, but without the class identifier to force javareg to create a CLSID and register it. Javareg will also recognize the /regserver switch for this command. The /register switch can also be used with several other switches to register a JavaBeans object as an ActiveX Control.
/codebase:[filename|URL] Specifies the base location, either a URL or a filename, to obtain the Java class.
/control Adds the necessary Registry information for containers to treat the Java class as an ActiveX control.
/typelib: [filename] Generates the type library for this Java class at the specified filename's location. In order to register a typelib without generating a new one, use this option combined with the nomktyplib option.
/nomktyplib Registers an existing typelib, specified in the filename argument of the /typelib switch, without creating a new one.
/unregister Unregisters the class specified in the class parameter. If /unregister is specified, /class:classname must be specified as well.
/class:classname Specifies the name (classname) to be registered with the classid (or with the CLSID generated by javareg if no classid is provided).
/clsid:CLSID Specifies the class identifier (CLSID) to be registered with the class. Omit this parameter to force javareg to create a CLSID.
/surrogate Supports remote access to COM classes. Writes the appropriate Registry entries necessary to allow the Java class to be activated out-of-process.
/progid:PROGID Specifies a ProgID for the class being registered.
/remote:RemoteServerName Activates the class on a remote server, using Distributed Component Object Model (DCOM).
/q Suppresses all message boxes (quiet mode).

Package Manager Extraction Utility (javasrc)

javasrc [-] [class_zip]

Extracts all java source files from class_zip, or classes.zip (created by clspack) if no .zip archive is specified.

Note If you run classd.exe from the \bin directory and then run javasrc, the error message, "Unable to open file classes.zip" may appear. Run javasrc from within the Java\Classes directory, or run it with a command line that includes the path to classes.zip.

C:\..\>javasrc C:\Windows\java\classes\classes.zip

The classd.zip debug source file is not installed automatically and can be installed from the Active Setup SDK installation program.

ParameterDescription
options The javasrc utility has the following command-line options:
/? Displays help and usage information.
- Deletes all java source files that are extracted from class_zip.

Java Win32 Executable Generator (jexegen)

jexegen [options] [@command file] filename

Converts Java classes into a fully executable Microsoft Win32® application.

For more information, see the Introduction to Jexegen.

ParameterDescription
options Can be a combination of the following:
/main:classname Sets the name of the main .class file. This option is required.
/nomain Indicates that no main .class file is specified (useful only in conjunction with the /raw or /bindto options).
/base:dir Changes the base directory used when determining package names of specified .class files to dir.
/out: filename Sets the output filename.
/r[–] Recurses into subdirectories when searching for the specified .class files. Use a hyphen (-) after the switch to disable this option if /r has already been used in the command string.
/v Provides detailed output.
/w The generated executable will not have an associated console window.
/bindto: stub Specifies the stub (.exe or .dll file) to bind the class resources to.
/raw Saves resource data to a file and does not generate an executable.

For a detailed description of each of these options, see Reference to Jexegen Command-Line Options.

@command file As an alternative to specifying all the class files and options on the jexegen command line, you can use a command file. For more information, see the Introduction to Jexegen.
filename Name of the Java .class file or files that the executable will be generated from.

Remarks:

If you do not specify the /out option, the utility creates the executable file Jex.exe (by default).

Examples:

The following command line creates the executable file, Hello.exe, from a single .class file, Hello.class.

jexegen /out:hello.exe /main:Hello Hello.class

The following command line creates the executable file, classvue.exe, from all classes in the classvue directory in the Microsoft SDK for Java.

jexegen /out:classvue.exe /main:ClassVue *.class

Windows NT Service Executable Generator (jntsvc)

jntsvc [options] [@command file] files

The jntsvc utility generates self-contained, self-installing/uninstalling, redistributable executables (.exe files) for Microsoft® Windows NT® system services.

For more information about using the jntsvc utility and about the user options for the generated service executable, see the com.ms.service package overview.

ParameterDescription
options Can be a combination of the following:
/base:dir Changes the base directory and is used to determine package names of specified class files. When used with the /raw or /bindto option, /base specifies the base directory that file operations are relative to. By default, package names and file operations are determined relative to the current directory. If this option is used more than once on the command line, all /base options are relative to the original (current) directory.
/out: filename Specifies the name of the output file.
/r Indicates that jntsvc should search recursively into subdirectories when searching for the specified class files. By default, subdirectories will not be searched.
/r– Used to turn off subdirectory recursion. This is only useful if the /r option has already been used.

As an example, consider the following partial command line:

/r This*.class /r- That*.class

This example command line instructs jntsvc to find all class files that match This*.class in the current directory and all subdirectories, and all files that match That*.class only in the current directory.

/v Verbose mode; provides detailed output.
/svcmain: classname (Required) Sets the name of the main service class file. This class must be derived from com.ms.service.Service. The name specified on the command line must be the same as the class's internal name; it is case-sensitive and you must separate package names with periods.

For example, if the service's class name is MyService and is in package MyPackage, the appropriate switch for jntsvc would be

/svcmain:MyPackage.MyService.

This option may be used multiple times to specify the service class of each service that may be run within the same process. One or more service-specific options may follow each service:
/servicemain: service name Sets the name the service is registered as.
/displayname display name Sets the descriptive name of the service. This is displayed in the first column of the Services control panel.
/eventsource event source name Sets the event source name. The default is Java Service. This is displayed in the Source column of the event viewer.
/classpath path Sets any additional class paths required. Because the service classes are embedded in the generated executable, this does not need to point to the service classes (unlike Microsoft SDK for Java version 1.5 services).

/bindto: stub Specifies the stub (.exe or .dll file) to bind the class resources to.
/raw Saves resource data to a file and does not generate an executable.
@command file As an alternative to specifying all the class files and options on the jntsvc command line, you can use a command file. For more information, see the Introduction to Jexegen.
files The name of the Java .class file or files that the executable will be generated from.

Remarks:

The use of the command file and specification of the class files in combination with the /base and /r options are identical to jexegen.

Microsoft Compiler for Java (jvc)

jvc [options] filename

Creates Java programs and applets by compiling Java source code.

For more information, see the Introduction to jvc and Jvc Release Notes.

For a listing of all errors and warnings produced by this compiler, see Jvc Errors and Warning Messages.

ParameterDescription
options Can be a combination of the following:
/cp classpath Sets the class path environment variable for the current compilation.
/cp:o Prints the class path to standard output.
/cp:p path Inserts the path entered and a semicolon to the beginning of the class path environment variable.
/d Specifies an output directory other than the current directory for the .class files.
/g [-] Generates all debugging information. Use a hyphen (-) after the switch to disable this option.
/g:l [-] Generates line number debugging information. Use a hyphen (-) after the switch to disable this option.
/g:t [-] Generates debug tables. Use a hyphen (-) after the switch to disable this option.
/nowrite Compiles a .java file and suppresses the writing of a .class file.
/O [-] Combines optimizing options to produce the fastest possible program. Use a hyphen (-) after the switch to disable this option.
/O:I [-] Optimizes compilation by inlining methods (when appropriate). Use a hyphen (-) after the switch to disable this option.
/O:J [-] Optimizes bytecode jumps (default setting). Use a hyphen (-) after the switch to disable this option.
/verbose Prints messages about compilation progress.
/w[0-4] Sets warning level (the default is 2).
/x [-] Disables extensions (the default is to enable extensions).

For a detailed description of each of these options, see Reference to Jvc Command-Line Options.

filename Name of one or more source files.

Remarks:

You can specify any number of options and filenames, if the number of characters on the command line does not exceed 1024 or the limit prescribed by the operating system.

Java Viewer (jview)

jview [options] classname [arguments]

Executes Java applets and applications from the command line.

For more information, see the Introduction to Jview.

ParameterDescription
options Can be a combination of the following:
/a Invokes the use of the Microsoft AppletViewer. Applets viewed with the Microsoft appletviewer function the same as when viewed with a browser, including sound, loading, security features, and so on. When the appletviewer switch is used, all other remaining command-line tokens become parameters used by the appletviewer.
/cp classpath Sets the classpath environment variable. For more information, see CLASSPATH Environment Variable.
/cp:a path Appends the path entered at the end of the classpath environment variable and inserts a semicolon between them.
/cp:p path Inserts the path entered and a semicolon at the beginning of the classpath environment variable.

For more information, see Reference to Jview Command-Line Options.

/p Pauses before terminating if an error occurs.
/n namespace Provides a namespace in which to run an application. This allows Java packages with identical names to exist without conflict, if they are in separate namespaces. The Microsoft JPM stores packages in a global namespace and searches there for packages if no namespace is specified to its API elements (for example, the contents of classes.zip is stored in the global namespace). Note, however, that applications running in the name space specified with the /n switch cannot access other namespaces.
/v Verifies all invoked methods (normally, only methods from untrusted loaders are verified).
/D:property=value Sets a system property to a specified value. System properties are defined in the Java.lang.system.getProperty method.
classname Name of the .class file to execute. Do not use the .class extension with this filename.
arguments Command-line arguments to be passed to the .class file supplied in classname.

X.509 Certificate Creation Utility (makecert)

makecert [options] OutputCertificateFile

Generates a test X.509 certificate. It creates a public and private key pair for digital signatures and associates it with a name that you choose. The utility also associates the key pair with a specified publisher's name and creates a X.509 certificate that binds your name to the public part of the key pair.

ParameterDescription
basic options The makecert utility supports the following basic options:
/sk Subject's key container name (will be created if not present).
/ik Issuer's key container name.
/# Serial Number from 1 to 2^31-1. Default to be unique.
/$ The signing authority of the certificate: either individual, commercial, minimal or all.
/n Certificate subject X500 name (eg: CN=Fred Dews).
/? Returns a list of basic options.
/! Returns a list of extended options.
extended options The makecert utility supports the following extended options:
/sc Subject's certificate file.
/sv Subject's PVK file (will be created if not present).
/sp Subject's CryptoAPI provider's name.
/sy Subject's CryptoAPI provider's type.
/ic Issuer's certificate file.
/iv Issuer's PVK file.
/is Issuer's certificate store name (default to my+root+ca).
/ir Location of issuer's certificate store, either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. The default is HKEY_CURRENT_USER.
/ip Issuer's CryptoAPI provider's name.
/iy Issuer's CryptoAPI provider's type.
/a The signature algorithm, either md5, or sha (the default is md5).
/d Display name for the subject.
/l Link to the policy information (such as URL).
/ky Key types, either signature or exchange (the default is signature).
/cy Certificate types, either end, authority, or both.
/b Start of the validity period (default to now).
/m The number of months for the certificate validity period.
/e End of validity period (defaults to 2039).
/h Max height of the tree below this certificate.
/g Create a glue certificate.
/r Create a self-signed certificate.
/nscp Include Netscape client-authorization extension.
/eku Comma separated enhanced key usage OIDs.
OutputCertificationFile The test X.509 certificate (.cer) file.

Remarks:

The makecert utility uses slightly different syntax dependent on whether Internet Explorer 3.02 or Internet Explorer 4.0 is used. See Java Code Signing in Microsoft® Internet Explorer 4.0 for more information.

Header File Converter for Java (msjavah)

msjavah [options] ClassName

Generates C language header files for Java classes.

ParameterDescription
options Can be a combination of the following:
/v Specifies verbose output.
/classpath pathname Sets an alternate class path to search in addition to the classpath environment variable.
/d output directory Specifies an output directory to place the header files. Ignored if the filename used with the /o option includes absolute pathnames.
/o outfile Specifies the output filename of the header file. By default, a separate header name is generated for each class name based on the class name. With this option specified, all classes are generated in the header file specified by outfile.
/nologo Suppresses the Microsoft copyright message.
/noclint Does not run class initializers in any specified classes. By default, msjavah attempts to run initializers. If the initializers fail, a warning message is displayed and the class is reloaded without running the initializers.
/nowritebarrier Produces headers without const declarations of object member fields. Newer implementations of the Java garbage collector require all members of objects that are object references be modified with the GCSetObjectReferenceForObject API. As a result, these fields are generated as const fields. Pragmas for the Microsoft compilers are generated to disable the appropriate warnings encountered when the compiler fails to generate default constructors. The /portable switch suppresses these pragmas, to ensure portability.
/portable Generates headers without enhancements specific to the Microsoft compiler (pragmas and so on).
/helpers Generates inline wrapper methods for making static and non-static Java calls through the execute_java_dynamic_method and execute_java_static_method Raw Native Interface APIs. Use of these helpers allows incompatible changes to a Java method's signature to result in compilation errors, rather than runtime errors.
/ctors Generates operator new wrapper methods for constructing Java objects through the execute_java_constructor API. This option is similar to /helpers; incompatible changes to constructors result in compilation errors, rather than runtime errors.
ClassName Name of the Java class to create a C header file for (required).

Remarks:

Unlike other utilities, you must give a Java class reference instead of a filename for the given class, as in the following example.

msjavah java.lang.Thread

One command can create multiple headers, and a header file will be created for each (unless the /o option is included). For example, the following command line produces two header files, java_util_Hashtable.h and java_lang_System.h.

msjavah java.util.Hashtable java.lang.System

In contrast, the following command line generates a file called headers.h, which includes both classes.

msjavah /o headers.h java.util.Hashtable java.lang.System

You can use the /portable switch to create headers that suppress pragmas specific to the Microsoft compiler, and other compiler information, to ease portability. The following command line produces a portable file called headers.h, which includes several classes.

msjavah /o /portable headers.h java.util.Hashtable 
    java.lang.System java.lang.Thread

You use the /helpers and /ctors options with the msjavah utility to generate inline RNI wrapper method calls. For example, the following class has a constructor and a static and a dynamic method.

class fuzzle {
	void dynamicMethod (int i) {}
	static void staticMethod (String s) {}
	fuzzle (int i1, int i2) {}
}

The msjavah utility generates the following native code.

C:\..\>msjavah /helpers /ctors fuzzle

void nativeMethod () {
	GCFrame gcf;
	struct gc {
		Hfuzzle *fuzzle;
	};
	GCFramePush(&gcf, &gc, sizeof(gc));
#ifdef __cplusplus
	// Note that arguments are presented *before* the
	// class name, as arguments to the 'new' operator
	// and not directly to the constructor.
	// Generated by /ctors
	gc.fuzzle = new (3, 10) Hfuzzle;
	// Generated by /helpers
	gc.fuzzle->dynamicMethod(5);
#else
	/* Generated by /ctors */
	gc.fuzzle = new_fuzzle(3, 10);
	/* Generated by /helpers */
	fuzzle_dynamicMethod(gc.fuzzle, 5);
#endif
	/* Generated by /helpers */
	fuzzle_staticMethod(makeJavaString("Hello", 5));
	GCFramePop(&gcf);
}

Permission INI File Editor (piniedit)

piniedit [inifilename]

Creates and edits .ini files for use with the signcode tool.

The Permission INI File Editor tool provides a quick way to create .ini files that are used with the signcode tool. The signcode tool uses .ini files to provide descriptions of the permission settings that Java applets need. Using an .ini file with the signcode tool enables you to digitally sign your applet with the permissions encoded within the digital signature. The other way to create .ini files requires manually creating the file and setting the value of each variable in the file. The Permission INI File Editor creates and edits .ini files quickly and easily by enabling you to specify the permissions using a graphical user interface.

To start the Permission INI File Editor, type piniedit on the command line, optionally followed by the name of the .ini file that you want to edit.

To edit the .ini file, choose a Tab that corresponds to a permission that you want to specify. You can then edit the permission by selecting appropriate check boxes and entering parameters in the text boxes. The following table lists the Tabs and the permissions that can be edited in each Tab.

Tab NamePermission Description
FileThe ability to read, write, or delete files.
RegistryThe ability to read, write, delete, create, or open keys in the registry.
NetworkThe ability to connect or bind to various hosts or ports on the network.
Client ServicesThe ability to access client storage, perform user-directed file I/O, access user interface functionality, print, use multimedia libraries, and access security classes.
SystemThe ability to run programs, access system properties, manipulate threads, and redirect system streams.
ReflectionThe ability to access public or declared members of a class, based on the class loader.
CustomThe ability to use a non-system permission designed by the user.

If you need more detailed information about these permissions and how to edit them, see the Editing Permission Sets section of the documentation for the cprmedit tool. (The cprmedit tool uses the same user interface as piniedit, but instead of editing .ini files, cprmedit sets Java permissions for security zones.)

You can select the High or the Medium button to set all permissions to a High or Medium security level, respectively. These buttons are useful if you want to save time by adding to or removing permissions from a preset group of permissions. Be aware that selecting High or Medium erases any permission editing that you have done previously and then resets the permissions to High or Medium. To clear the settings for all permissions, select the Clear button. To create an .ini file with a Low security level, select the Full Permissions button. This setting allows all permissions.

You can also load the permissions from a specific zone by choosing Load from Zone from the Zone menu. This action will allow you to edit the .ini file using a set of permissions that are identical to the permissions for the specified zone.

To add ActiveX permissions to the .ini file, select the ActiveX permissions button.

When editing the File, Registry, Network, property access, or execution access permissions, you can use the asterisk (*) and the question mark (?) as wildcard characters in the text boxes. You can use semicolons (;) to delimit multiple entries in the property access and execution access text boxes. Multiple ports in the Network permission should be separated by commas.

If you are using an asterisk, a question mark, or a semicolon as a literal in an expression, you need to precede the literal character with a backslash and put the whole expression in double quotes. Each literal backslash must also be preceded by a backslash. For example, if you want to specify all files in the c:\windows directory whose second character is the asterisk, you should enter "c:\\windows\\?\**".

When you have finished editing the permissions, you should save the file. To save the permissions as an .ini file, choose Save from the File menu. To save the edited permissions to a zone, choose Save to Zone from the Zone menu, which will modify the permissions that are recognized by Internet Explorer 4.0 and later for the specified zone.

For more information on .ini files, see the Sample Permissions INI File and the Java Permissions INI Values Reference. To learn how .ini files are used with the signcode tool, see the Signing a Cabinet File with Java Permissions Using Signcode article.

Java Class Viewer (qvue)

qvue [options] classname

Prints out class method signatures and identifies .class files that were generated from a type library.

ParameterDescription
options Can be used with:
/s Only prints the type of class (whether a Java class or a class generated from a type library). Does not print the class methods.
classname Specifies the name of the .class file to inspect. Qvue supports wildcards.

Remarks:

The qvue utility is similar to the jactivex utility's /javatlb /u option, which prints out class file summaries. The qvue utility is convenient for selecting the correct class file to use when the class files are generated from a type library using jactivex.

Win32 Resource File Merging Utility (resmerge)

resmerge [-a] target filename appended file 1 appended file 2 ...

The resmerge utility combines multiple Win32 resource (.res) files into a single file.

ParameterDescription
options The resmerge utility supports the following option:
-a Appends the specified resource files to the first named resource file (the target file).
target filename The primary file that other files will be appended to.
appended files Additional files that are appended to the target file.

Cabinet File Signing Utility (signcode)

signcode [options] -j JavaSign.dll [-jp level] [more options] filename

Signs a cabinet file with Java permissions to give developers more detailed control over the security restrictions placed on their applet when it is used over the Internet or an intranet.

For more information, see Signing a Cabinet File with Java Permissions Using Signcode.

ParameterDescription
options SignCode accepts the following command-line options:
/j JavaSign.dll The option that tells the signcode utility to use Java permission information.
/jp level Level is an optional string that tells what level of permissions to encode in the cabinet file. This must occur immediately after the /j parameter. You can use any of the following flags:

Low Medium High LowX MediumX HighX

If the string is not one of these six, it is accepted as the name of an .INI file that specifies the permissions to encode. You can create this .INI file by hand, following the example provided by the sample permissions .INI file, or you can use the piniedit tool to generate the .INI file for you. See Using Signcode with Java Permission Information and the .INI Permissions Reference for more details on custom permissions.

If the /jp option is not specified, a default level of LowX will be used. The exact permissions associated with these flags were previously described in Cabinet File Permission Levels and Cabinet Files and ActiveX.

Other Options
/spc SPC file containing software publishing certificates.
/v Pvk filename containing the private key.
/k Key container name.
/n Text name representing content of the file to be signed.
/i Place to get more information on content (usually a URL).
/p Name of the cryptographic provider on the system.
/y Cryptographic provider type to use.
/$ Signing authority of the certificate, either individual or commercial. The default is using the certificate's highest permission.
/a Hashing algorithm for signing, either md5 or sha (the default is md5).
/t TimeStamp server's http address.
/c Software publishing certificate file.
/s Certificate store containing certificates (the default to my+root+ca+spc).
/sp Add all the certificates in the chain or add only to spc store (the default is chain).
/r Location of the certificate store in the registry, either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. The default is HKEY_CURRENT_USER.
/add Add the certificate in the store in signing.
/addr Location of the added cert store in the Registry, either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER (the default is HKEY_CURRENT_USER).
/x Does not sign the file. Only timestamps the file.

Remarks:

To add the Java permission information into the signature, add the /j JavaSign.dll option to signcode. You may also specify the /jp option for finer control over the exact permissions in the signature.

Java Window Viewer (wjview)

wjview [options] classname [arguments]

Executes Java applets and applications from the command line and spawns a separate window process.

ParameterDescription
options Can be a combination of the following:
/a Invokes the use of the Microsoft AppletViewer. Applets viewed with the Microsoft appletviewer function the same as when viewed with a browser, including sound, loading, security features, and so on. When the appletviewer switch is used, all other remaining command-line tokens become parameters that are used by the appletviewer.
/cp classpath Sets the classpath environment variable. For more information, see CLASSPATH Environment Variable.
/cp:a path Appends the path entered at the end of the class path environment variable and inserts a semicolon between them.
/cp:p path Inserts the path entered and a semicolon at the beginning of the classpath environment variable.
/n namespace Provides a namespace in which to run an application. This allows Java packages with identical names to exist without conflict, if they are in separate namespaces. The Microsoft JPM stores packages in a global namespace and searches there for packages if no namespace is specified to its API elements (for example, the contents of classes.zip is stored in the global namespace). Note, however, that applications running in the name space specified with the /n switch cannot access other namespaces.
/v Verifies all invoked methods (normally, only methods from untrusted loaders are verified).
classname Name of the .class file to execute. Do not use the .class extension with this filename.
arguments Command-line arguments to be passed to the .class file supplied in classname.

Remarks:

Use this utility to launch window-based Java applications and applets. This utility is the same as the jview utility, with the exception that wjview runs the application as a separate graphical user interface (GUI) process and does not use or require a console window. Consequently, you do not use wjview for Java applications that require output to or input from the console window.

Top © 1998 Microsoft Corporation. All rights reserved. Terms of use.