The role of the Eclipse. Project file. classpath file

Source: Internet
Author: User

The role of the. classpath file

You can refer to the role of the. classpath file

The role of the. project file

Make sure your own eclipse can create a Java project and correctly compile and run HelloWorld to configure the Java environment for Eclipse

Based on what .classpath文件 we seem to have different versions of the .project文件 impact on the project

<?xml version="1.0" encoding="UTF-8"?><classpath>    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>    <classpathentry kind="src" path="src"/>    <classpathentry kind="src" path="lib"/>    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">        <attributes>            <attribute name="maven.pomderived" value="true"/>        </attributes>    </classpathentry>    <classpathentry kind="output" path="bin"/></classpath>
Version 1

There is only one project name
. project file Contents

<?xml version="1.0" encoding="UTF-8"?><projectDescription>    <name>blockchain</name>    <comment></comment>    <projects>    </projects>    <buildSpec>                </buildSpec>    <natures>    </natures></projectDescription>

Project

Version 2
<?xml version="1.0" encoding="UTF-8"?><projectDescription>    <name>blockchain</name>    <comment></comment>    <projects>    </projects>    <buildSpec>    </buildSpec>    <natures>        <nature>org.eclipse.jdt.core.javanature</nature>    </natures></projectDescription>

Project

Happy, with the Jre,maven also came out, browse every. java file, found no error, run the project to see

Error after running the project:
Error: The main class could not be found or could not be loadedcom.langdon.blockchain.Main
Why? The main function has already been written, why can not find it?
Let's see if there .class文件 's a build, and there's nothing in the project that .class文件 the original project was not compiled by Eclipse.

Version 3
<?xml version="1.0" encoding="UTF-8"?><projectDescription>    <name>blockchain</name>    <comment></comment>    <projects>    </projects>    <buildSpec>        <buildCommand>            <name>sf.eclipse.javacc.javaccbuilder</name>            <arguments>            </arguments>        </buildCommand>    </buildSpec>    <natures>        <nature>org.eclipse.jdt.core.javanature</nature>    </natures></projectDescription>

No changes to the project chart

Run effect: Succeeded, .class文件 successfully appeared in the Bin folder under the project directory

If you still get an error: Attempt to modify, save, undo Modify, Save- .classpath文件 .classpath文件
( Remember to refresh the project in eclipse every time you modify the. Project file )

Some conclusions
<natures>    <nature>org.eclipse.jdt.core.javanature</nature></natures>

Nature describes the nature of the project, is the static property of the project, you can add multiple nature for the project;
Buildcommand is the dynamic property of the project, which shows what tools need to be used to build the project;
Also say is: nature-plug-in, buildcommand-loading mode

The role of the Eclipse. Project file. classpath file

Related Article

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.