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