MyEclipse in the classpath.

Source: Internet
Author: User

Blog Category:
    • Java Basics
 

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 this project to import into their own myeclipse will be an error, this time it is only manual to write this file, MyEclipse classpath file is the project root directory ". Classpath" file, the format is as follows:

Java Code
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <classpath>
  3. <classpathentry kind="src" path="src"/>
  4. <classpathentry kind="con" path="Org.eclipse.jdt.launching.JRE_CONTAINER"/>
  5. <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_6_ CONTAINER "/>
  6. <classpathentry kind="con" path="Org.eclipse.jst.j2ee.internal.web.container"/>
  7. <classpathentry kind="con" path="Org.eclipse.jst.j2ee.internal.module.container"/>
  8. <classpathentry kind="Output" path="webroot/web-inf/classes"/>
  9. </classpath>

<classpath> ...</classpath> This tag is classpath information, which generally contains the following five forms:

1.<classpathentry kind= "src" path= "src"/>

          corresponds to source  A directory of type folder, 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 itself is a source folder, so it is automatically written to this file, and if you manually set up a Source folder, the folder will also be written to this file, form is above the form of eg. create a new test Source folder on the project basis, and it will be like this:   < classpathentry kind= "src"  path= "src" />  

<classpathentry kind="src" path="test"/>

2, <classpathentry kind="Con" path="Org.eclipse.jdt.launching.JRE_CONTAINER"/ >

This sentence is to indicate the operating environment of the program kind="Con"---represents the type of classpath, Con is container, is the program run container, or is said to be running environment is OK, It is actually in the myeclipse initially to configure the installed JREs specified (typically we specify the JDK), but this is actually used in the JDK under the JRE of the jar package, that is, Jdk_home/jre/lib is the corresponding statement

3, <classpathentry kind= "con" path= "melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_6_ CONTAINER "/>

This is kind="Con", of course, is the same as the previous article, is a container for 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 to the server when the project is deployed, because myeclipse think that such a jar package is the server should have, so there are sometimes problems, there is no problem in the 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 a lightweight web container), it is necessary to differentiate between the development environment and the operating environment.

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

This statement kind="Lib", corresponding to the library file in the classpath, path specifies the paths of the library files, also relative to the project root directory relative path

5,<classpathentry kind="Output" path="webroot/web-inf/classes"/>


This represents the project's output directory, the entire previously defined classpath either kind= ' src ', kind= "con", kind= "Lib", which will be entered into this directory after compilation, 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

kind= "src"----corresponding source folder directory
Kind= "Con"--the container of the project, usually when it is a Java Web project, there are two
kind= library files used in the project---"Lib"
Kind= ' outputs '--output directory, the target directory of the final compiled related files, MyEclipse will automatically complete the relevant copy

Practice: Use MyEclipse 9 as the IDE, download a Web project, edit find missing Servlet.jar, Jsp.jar, deploy to Tomcat to work properly, because Tomcat comes with these packages, but in the development environment can not find, open project-" Property-->java Build Path-->libray

Found there is a: Melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_6_CONTAINER inside no jar, check the above information, found that this directory is what I am looking for, Only used in the development environment, the deployment will not be copied to the Tomcat directory, so to add the required jar for this directory, repeated testing, found that the directory of the JAR package has no way to increase. For thought, this is the project in some path, and my myeclipse there is no this path, so there is no jar package, then change to myeclipse some environment is not on the line.

Click the Add Library button--"MyEclipse library-->J2EE 1.5 librariesu problem resolution.

MyEclipse in the classpath.

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.