Classpath Path in Java project

Source: Internet
Author: User

The project uses the Classpath path to refer to the file, so what does classpath mean?

I first put the above applicationcontext.xml file in the SRC directory found can.

So classpath in the end is where, on the internet to read a few blog

The Yellow Line section explains the problem I put in the SRC directory to use classpath: Access.

But the red line part, he said this sentence right, I feel a problem.

And then I tried it.

Found either in the Web-inf directory, or under the Web-inf/lib. web-inf/classes file isn't yet .....

Then go to the project workespaces see Bulib/classes (Here is classpath path) found Applicationcontext.xml not in

Click to open the. classpath file under the compiled project found there are four types of kind

. Classpath Content Interpretation

The. Classpath is a dependent file that describes the project:

    1. The exact location of the source file (kind= "src")
    2. Operating system environment (kind= "con")
    3. Specific location information for the project's library (kind= "Lib")
    4. In each LIB's XML child node, there is additional configuration information about it (for example, the "Javadoc_location" I configured)
    5. Output Directory of the project (kind= "Output")

In general, this document is the configuration of the entire project operating environment.

We can see that kind is src only "src" and does contain Web-inf folder

Then I saw a blog to solve the problem of Classpath path http://blog.sina.com.cn/s/blog_792701cd0101hpbr.html

Then I added a line to the. classpath

Run successfully!

Go to Workespaces/project name/build/classes/found

Hey! Applicationcontext.xml in.

This can be summed up:

1. In compiling the generated file. The type of kind= "src" in classpath is the classpath path, which can be referenced in the Classpath:xxx way in the project. You can also manually come to add, expand the scope of classpath, <classpathentry kind= "src" path= "XXX"/>

That means you want to know what classpath means. Classpath look at kind= "src".

2, in the compilation generated under the project bulid/classes/files are classpath path files, can be obtained through the classpath: method.

3, "SRC is not classpath, Web-inf/classes,lib is classpath" This sentence is not right , this is to write the project saw, the real classpath is compiled after the bulid/classes/ (as explained in 2)

Classpath Path in Java project

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.