Setting the Java Class Path

Source: Internet
Author: User

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 Me Thod) or BBY setting the CLASSPATH environment variable.

The-classpath option is preferred beacuse you can set it individually for each application without affecting other applic Ations 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 of the class path should end with a file name or directory depending on what is 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 F Irst package in the full package name.

Multiple path entries is separated by semicolons and 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 inclu De the current direcoty in the search path,

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

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

Setting the Java Class Path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.