|
preverify — prepare class files so that a MIDP implementation can run them. Optionally inspect the files for features of the Java™ programming language that are not part of the CLDC specification.
preverify[ -classpath path ] [ -d directory ] [ -cldc ] [ -nofinalize] [ -nonative ] [-nofp] [ @file ] [ -verbose ] inputFiles
The preverify tool prepares class files, JAR files, and directory trees of class files so that they can be run by MIDP implementations. (The preverified class files can still be run by the Java 2 Platform, Standard Edition.)
The output of the tool mirrors the input: For each class file the tool is given, it writes a new class file of the same name to the destination directory. For each JAR file, it writes a new JAR file of the same name to the destination directory. For each directory name, it recursively handles every class file under that directory and writes new class files of the same names in the same hierarchical structures as the original directories.
In addition to creating new class files, the preverify tool can check the class files for Java programming language features that are not part of the CLDC specification. If a feature is not part of the CLDC specification, it cannot be used in code that MIDP will run. If it finds a forbidden feature, it reports the problem.
The following options are supported:
none
Running the tool without options returns the same information as the -help option.
-classpath path
Specifies the location of the MIDP and CLDC classes. The path can contain directories or JAR files. On systems that run the Solaris™ Operating Environment, the list of locations is colon-separated. On Microsoft Windows platforms the list is semicolon separated.
-d directory
Specifies the destination directory where this tool writes its output files. The default directory is ./output.
-cldc
Causes checks in the input class files for all Java programming language features that are not part of the CLDC Specification: floating point operations, finalizers, and native methods. It reports errors if it finds them.
Using this switch is equivalent to using the -nofinalize, -nonative, and -nofp switches.
-nofinalize
Causes checks for the use of finalizers in the input class files. It reports errors if it finds them.
-nonative
Causes checks for the use of native methods in the input class files. It reports errors if it finds them.
-nofp
Causes checks for the use of floating point operations in application classes. It reports errors if it finds them.
-verbose
Causes the printing of additional messages that describe the tool’s actions. If this flag is not used and there are errors when creating an output JAR file, the errors will be written to directory/jarlog.txt. The directory/jarlog.txt file will not be created if inputFiles does not contain a JAR file or if there are no errors.
@fileName
Specifies the name of a text file from which the options and operands to the tool will be read. The parameters must be on a single line. If -classpath or -d are present, their values (path and directory) must be enclosed in double quotes.
For example, the contents of fileName could be:
-classpath “api/classes;e:/samples/classes” -d “output” -nofp -verbose HelloWorld1 HelloWorld2 HelloWorld3
The following operand is supported:
inputFiles
One or more files to be preverified. The files can be in three different formats:
The names of the input files should be separated by white space.
0
Successful completion.
>0
An error occurred
The following examples assume that the directory that holds the preverify command is a value on your PATH environment variable.
The following command preverifies class files but does not check them for features that are not in the CLDC specification. It writes the output to the c:\work\myMIDlet\classes directory.
c:\work\myMIDlet\tmpclasses> preverify -d c:/work/myMIDlet/classes -classpath c:/midp2.0fcs/classes MyMIDlet alerts/About forms/Splash
The following command is a simpler version of the preceding one. Instead of listing the class files individually, it specifies the parent directory of the class files.
The following example preverifies Java class files and checks them for the features that are not in the CLDC specification. Its output will go into the default location, the ./output/ directory.
c:\work> preverify -classpath c:/midp2.0fcs/classes -cldc myMIDlet/tmpclasses MIDletFromCoworker.jar AnotherClass
The following example preverifies Java class files and checks them for floating point operations. It assumes that the MIDP class files are in the CLASSPATH environment variable, and writes the output to c:\work\myMIDlet\classes directory:
c:\work> preverify -d c:/work/myMIDlet/classes -nofp myMIDlet/tmpclasses/MyMIDlet MIDletFromCoworker.jar
The following environment variables interact with specific features of this tool:
PATH
Provides the location of the jar tool, which this tool calls to create the new, output JAR file. The jar tool must be accessible on your PATH if you provide a JAR file as input to the preverify tool.
CLASSPATH
Provides this tool with a path to MIDP, CLDC, and user-defined classes. The -classpath switch overrides the value of this environment variable.
Creating MIDlet Suites
|
Using MIDP MIDP Reference Implementation, Version 2.0 FCS |
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.