The role of dot '. ' in Java's classpath path

Source: Internet
Author: User

“.” Represents the current directory, which is the. class file in the directory where you are compiling or executing the program, while Java_home represents the JDK installation path

The path is passed in as Vmarg in Eclipse, and you can see it in the Task Manager by opening the command line, and now to experiment, print out the current path and see what it looks like.

Aaa.java file path

Content in Aaa.java:

Package Test;

Class aaa{

public static void Main (string[] args) throws urisyntaxexception {
//output Here is the current file
System.out.println (Classloader. Getsystemclassloader (). GetResource ( "."). Touri (). GetPath ());
}
}

The result of the output is:/f:/bupt/project/leetcode/out/production/leetcode/

When running, look for the Test/aaa.class file directly under the path (/f:/bupt/project/leetcode/out/production/leetcode/), which is/f:/bupt/project/leetcode/ Ot/poduction/leetcode/aaa.class files can be.

If we delete the compiled. Class and then run Aaa.java, an error occurs

jdk1.6 above will not need to configure the CLASSPATH, the system will automatically help you configure, you only need to configure Java_home and path is OK, such as my configuration: java_home:e:\java\jdk1.7.0\ path appended;%java_ Home%\bin;%java_home%\jre\bin;

About ".", in DOS and Linux, represents the current directory, "..." Represents the top-level directory of the current directory

./Is the current directory

.. /is the previous directory

.. /.. /is the previous directory

The role of dot '. ' in Java's classpath 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.