Java classpath role

Source: Internet
Author: User

Configuration of environment variables:

1): Permanent configuration mode:java_home=% installation path%\JAVA\JDK

Path=%java_home%\bin

2): Temporary configuration mode:set path=%path%; C:\Program Files\java\jdk\bin

Features: The system defaults to the current path to find the program to execute, if not, then go to the path set in the paths to find.

Configuration of the classpath:

1): Permanent configuration mode:classpath=.; C:\;e:\

2): Temporary configuration mode:set classpath=.; C:\;e:\

Note: What you need to be aware of when defining classpath Environment variables

If you do not define an environment variable Classpath,java starts the JVM, it looks for the class file to run under the current directory;

if classpath is specified, the class file to be run is looked up under the specified directory.

Will you find it in the current directory? Two cases:

1): If there is a semicolon at the end of the Classpath value, the running class is not found in the specific path, and will be found again by default in the current directory.

2): If the value of classpath results in no semicolon, the running class is not found in the specific path and is no longer found in the current directory.

generally do not specify a semicolon , if not found in the specified directory to run the class file, the error, so you can debug the program.

What do 4,javac commands and Java commands do?

you know that Java is divided into two parts: one is compile, one is run.

Javac: is responsible for the compilation of the part, when executing javac, will start the Java compiler program. Compiles a. java file with the specified extension. Generates bytecode files that the JVM can recognize. This is the class file, which is Java's running program.

Java: the part that is responsible for the run . The JVM is started. Then load the class library that is required by the runtime and execute it.

a file to be executed must have a starting point for execution, and this starting point is the main function.

5, Virtual machine

when I do software reviews in a virtual machine, it can crash like a system, but it crashes just the operating system on the virtual machine, not the operating system on the physical computer, and with the Undo feature of the virtual machine, I can immediately restore the virtual machine to the state before the software was installed.

Java classpath role

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.