The Java Virtual Machine Specification, version 2, says absolutely NOTHING about the CLASSPATH item, neither as an environment variable, a JVM command line parameter, or anything. Instead, section 5.3.1 states, "The Java virtual machine searches for a purported representation of [class] C in a platform-dependent manner. Note that there is no guarantee that a purported representation found is valid or is a representation of C. Typically, a class or interface will be represented using a file in a hierarchiacal file system. The name of the class or interface will usually be encoded in the pathname of the file."
This is the industry standard practice, as implemented by use of the CLASSPATH variable. This header file defines its characteristics. The same goes for the JAVA_PATH environment variable, which has no further definitions that its name and string content that contains a path name. Since these variables are actually a part of standard practice, their names are actually defined in jvmcfg.h instead of here, but CLASSPATH behavior is defined here.
Conventions for OS file systems (see also jvmcfg.h for JVMCFG_PATHNAME_xxx and JVMCFG_EXTENSION_xxx definitions).
Unix style: CLASSPATH="/path/name1:/path/name2/filename.jar" Windows style: CLASSPATH="c:\path\name1;d:\path\name2\\filename.jar"
Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file classpath.h.
Go to the source code of this file.
File extensions | |
Convention for class file names, but not mandatory. | |
#define | CLASSFILE_EXTENSION_DEFAULT "class" |
#define | CLASSFILE_EXTENSION_JAR "jar" |
#define | CLASSFILE_EXTENSION_ZIP "zip" |
Defines | |
#define | CLASSPATH_ITEM_DELIMITER_CHAR ':' |
Delimiter betwen members of CLASSPATH string. | |
Functions | |
ARCH_COPYRIGHT_APACHE (classpath, h,"$URL: https://svn.apache.org/path/name/classpath.h $ $Id: classpath.h 0 09/28/2005 dlydick $") | |
rchar * | classpath_external2internal_classname (rchar *clsname) |
Convert class name format external to internal form. | |
rchar * | classpath_external2internal_classname_inplace (rchar *inoutbfr) |
rchar * | classpath_get_from_cp_entry_utf (cp_info_dup *clsname) |
Search CLASSPATH for a given class name using a CONSTANT_Utf8_info. | |
rchar * | classpath_get_from_prchar (rchar *clsname) |
Search CLASSPATH for a given class name using a prchar. | |
rvoid | classpath_init (rvoid) |
rboolean | classpath_isjar (rchar *pclasspath) |
Determine whether or not a CLASSPATH entry is a JAR file instead of being a directory name. | |
rvoid | classpath_shutdown (rvoid) |
|
Delimiter betwen members of CLASSPATH string.
Definition at line 85 of file classpath.h. |
|
Definition at line 99 of file classpath.h. |
|
Definition at line 100 of file classpath.h. |
|
Definition at line 101 of file classpath.h. |
|
|
|
|
|
|
|
Determine whether or not a CLASSPATH entry is a JAR file instead of being a directory name.
A JAR file will be named
Definition at line 279 of file classpath.c. |
|
Convert class name format external to internal form.
The external format is
Definition at line 333 of file classpath.c. |
|
Definition at line 358 of file classpath.c. References CLASSNAME_EXTERNAL_DELIMITER_CHAR, and CLASSNAME_INTERNAL_DELIMITER_CHAR. |
|
Search CLASSPATH for a given class name using a prchar. Return heap pointer to a buffer containing its location. If not found, return rnull. If a class by this name is stored in more than one location, only the first location is returned. When done with result, call HEAP_FREE_DATA(result) to return buffer to heap area. All CLASSNAME_EXTERNAL_DELIMITER (ASCII period) characters found in the input class name will be unconditionally replaced with CLASSNAME_INTERNAL_DELIMITER (ASCII slash) characters. Therefore, the class file extension CLASSFILE_EXTENSION_DEFAULT may not be appended to the class name. This constraint permits both internal and external class names to use the same function to search for classes.
package some.package.name statement in source.
rchar *p = classpath_get_from_prchar( "some/package/name/SomeClassName"); if (rnull != p) { if (rtrue == classpath_isjar(p)) { ** Extract class from JAR file ** } else { ** Read class file directly ** } } < Convenient size for any disk path < terminator for instance of class
< Convenient size for a For internal use only.
Build up JAR command using internal class name with suffix. Make sure all files are writeable for final Definition at line 444 of file classpath.c. |
|
Search CLASSPATH for a given class name using a CONSTANT_Utf8_info. Invoke classpath_get_from_prchar after converting clsname from CONSTANT_Utf8_info to prchar. For more information, see classpath_get_from_prchar.
Definition at line 630 of file classpath.c. |