The Classpath in MyEclipse

Source: Internet
Author: User

The classpath in MyEclipse is a very important question.
MyEclipse in the search is based on their search, and MyEclipse have a special file to save Classpath information, this is someone else's project copy of the time required an important document, Otherwise the project will be imported into its own myeclipse error, this time it is only manual to write this file
The MyEclipse classpath file is the ". Classpath" file in the project root directory, in the following format:
<?xml version= "1.0" encoding= "UTF-8"? ><classpath><classpathentry kind= "src" path= "src"/>< Classpathentry kind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER"/><classpathentry kind= "con" path= " Melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER "/><classpathentry kind=" Lib "path= "Webroot/web-inf/lib/bsf-2.3.0.jar"/><classpathentry kind= "Lib" path= "webroot/web-inf/lib/ Commons-beanutils-1.7.0.jar "/><classpathentry kind=" Lib "path=" Webroot/web-inf/lib/commons-chain-1.1.jar "/ ><classpathentry kind= "Lib" path= "Webroot/web-inf/lib/commons-digester-1.8.jar"/><classpathentry kind = "Lib" path= "Webroot/web-inf/lib/commons-fileupload-1.1.1.jar"/><classpathentry kind= "Lib" path= "WebRoot/" Web-inf/lib/commons-io-1.1.jar "/><classpathentry kind=" Lib "path=" webroot/web-inf/lib/ Commons-logging-1.0.4.jar "/><classpathentry kind=" Lib "path=" webroot/web-inf/lib/ Commons-validator-1.3.1.jar "/><classpathentry kiNd= "Lib" path= "Webroot/web-inf/lib/oro-2.0.8.jar"/><classpathentry kind= "Lib" path= "webroot/web-inf/lib/ Struts-core-1.3.8.jar "/><classpathentry kind=" Lib "path=" Webroot/web-inf/lib/struts-el-1.3.8.jar "/>< Classpathentry kind= "Lib" path= "Webroot/web-inf/lib/struts-extras-1.3.8.jar"/><classpathentry kind= "Lib" Path= "Webroot/web-inf/lib/struts-faces-1.3.8.jar"/><classpathentry kind= "Lib" path= "WebRoot/WEB-INF/lib/" Struts-mailreader-dao-1.3.8.jar "/><classpathentry kind=" Lib "path=" webroot/web-inf/lib/ Struts-scripting-1.3.8.jar "/><classpathentry kind=" Lib "path=" Webroot/web-inf/lib/struts-taglib-1.3.8.jar " /><classpathentry kind= "Lib" path= "Webroot/web-inf/lib/struts-tiles-1.3.8.jar"/><classpathentry kind= "Output" path= "Webroot/web-inf/classes"/></classpath>

First sentence

<?xml version= "1.0" encoding= "UTF-8"?>

This is the version that indicates the XML used, and the encoding used

<classpath> ...</classpath>

This label is stored in the classpath information, which generally contains the following five types:

< classpathentry kind = "src" Path="src"/>

< classpathentry kind="Con" Path ="Org.eclipse.jdt.launching.JRE_CONTAINER"/>

< classpathentry kind="Con" path="Melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER "/>

< classpathentry kind="Lib" Path ="Webroot/web-inf/lib/bsf-2.3.0.jar"/>

< Classpathentry Kind="Output" path="webroot/ Web-inf/classes "/>

< Classpath Kind="src" path="src">  

corresponds to a directory of source folder type, kind---represents the type of this classpath, path represents the paths in the project, path uses the relative path of the root directory (relative to the relative path of the. classpath file itself), The SRC in the MyEclipse project is itself a source folder, so it is automatically written to this file, and if you manually create a source folder, the folder will also be written to this file, form is the above form of eg. create a new test source folder based on the project and it will be like this

< Classpathentry Kind="src" path="src"/>   

< Classpathentry Kind="src" path="Test" />

< Classpathentry Kind="Con" path=" Org.eclipse.jdt.launching.JRE_CONTAINER "/>

This sentence indicates the operating environment of the program. Kind = "Con" ---Represents the type of classpath, Con is container, is the container for the program to run, or it is OK to run the environment, it is actually in MyEclipse initially to configure installed JREs (typically we specify a JDK), but this is actually using the jar package in the JRE under the JDK, that is, Jdk_home/jre/lib is the corresponding statement <BR >   

< Classpathentry Kind="Con" path=" Melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER "/>

This sentence is Kind = "Con" of course, as in the previous article, is the container that represents the runtime, in general, Java Web Project will have, it is included in the EE server to use some of the jar package, the directory of the Jar is the most special, that is, it will not be deployed in the deployment of the project to the server, Because MyEclipse think that such a jar package is the server should have, so there are sometimes problems, there is no problem in development, but after the deployment will be wrong, there are some servers have a jar package is not provided, such as Tomcat ( Because Tomcat is not a professional Web server, it is just a lightweight web container, which distinguishes between the development environment and the running environment .

<classpathentry Kind="Lib" path="webroot/web-inf/lib/ Bsf-2.3.0.jar "/>

this statement Kind = "Lib" , corresponding to the library files in the classpath, path specifies the paths of the library files, and the relative paths relative to the project root directory.

<classpathentry Kind="Output" path="webroot/web-inf/classes "/>

this represents the output directory of the project, the entire previously defined classpath either Kind = ' src ', Kind = "Con" , Kind = "Lib" , it will go into this directory after compiling, in the Java WEB is webroot/web-inf/classes. The same path is relative to the relative path of the project root (relative to the. classpath file itself), but because the Java EE section itself requires the Web server itself to have those jar packages, the exception will not be copied

Summarize:

Classpath is an important document for MyEclipse, which is used when making related searches.

The ". Classpath" file in the project root directory is the file that holds the project Classpath

In the file

< Classpath > ... ... </ Classpath > A variety of classpath information is saved, kind represents the type, path represents the route, and the use is relative to "

. classpath "or the relative path to the project root directory

The meanings of several kind:

Kind = "src"----corresponds to the source folder directory

Kind = "Con" --a container for the project, typically two when Java Web projects are </ SPAN > </ SPAN > </ P >   

Kind = "Lib" ---The library files used in the project

Kind = ' Output '--The output directory, the target directory of the final compiled related files, MyEclipse will automatically complete the relevant copy Finally, the management of MyEclipse classpath is realized through this file!

The Classpath in MyEclipse

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.