1. 程式人生 > >Setting the Java Class Path

Setting the Java Class Path

run include for each first -c try odi ons ignore

  The class path is the path taht Java Runtime Environment(JRE) searches for classes and other resource files.

Synopsis:

  The class serach path (classpath) can be set suing either the -classpath option when calling a JDK tool( the preferred method) or bby setting the CLASSPATH environment variable.

The -classpath option is preferred beacuse you can set it individually for each application without affecting other applications and without outher applications modifying its value.

sdkTool -classpath classpath1:classpath2...

set CLASSPATH=classpath1;classpath2...

sdkTool

  A command-line tool, such as java, javac, javadoc, or apt.For a listing, see JDK Tools and Utilites at

http://docs.oracle.com/javase/8/docs/technotes/tools/index.html

classpaht1:classpath2

  Classpaths to the JAR,zip or class files.Each class path should end with a file name or directory depending on what you are setting the class path to, as follows:

`For a JAR or zip file that contains class files, the class path ends with the name of the zip or JAR file.

`For class files in an unnamed package, thje class path ends with the direcotry that contains the class files.

`For class files in a named package, the class path ends with the directory that contains the root package, which is the first package in the full package name.

Multiple path entries are separated by semicolons with no spaces around the equals sigh (=) in windows.

The defalut class path is the current direcoty. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current direcoty in the search path,

then you must include a dot(.) in the new settings.

Class path entries that are neither directories nor archives (.zip or JAR files) nor the asterisk(*) wildcard character are ignored.

Setting the Java Class Path