The eclipse project icon shows a small red cross but not on the internal file tree

    Recently, I encountered some problems when using eclipse to develop a website project. Other people's projects are transferred to eclipse on their computer to report an error, and their own projects are transferred to eclipse on other people's computers to report an error, and they can't be used. Here is a small summary.

    The main situation is shown in the figure below - the project icon shows a small red cross but the internal file tree does not display the small red cross.


    At this point, click on the top toolbar Window->Show View->Other->General->Problems, and the Problems window will pop up at the bottom. Click Error and the following error statement will appear.

    I have mainly encountered two

    Target runtime com.genuitec.runtime.generic.jee60 is not defined

    as well as

    Project facet Java 1.8 is not supported by target runtime Apache Tomcat v7.0.

① Solution to the first problem

    The first problem is mainly caused by the existence of a <runtime> tag in the org.eclipse.wst.common.project.facet.core.xml file in other people's projects, which contains relevant definitions and declarations. Find this xml and delete the <runtime> tag and its contents and save it.

    The location of this xml file can be found in the .setting folder in your project directory. The opening method can be selected by yourself. As shown below.



    Open the xml file, I opened it with vs2013.


    Just delete the <runtime> tag

② Solution to the second problem

    The second problem is more common. It is caused by the mismatch between the JDK version of your project and the JDK environment configured on other people's computers. This is a little more troublesome, first reconfigure the JDK environment of eclipse on your own computer according to the JDK version on other people's computers, and then change the relevant settings in the project, and then export the war package and send it to him. . Of course, if your own computer version is too low, other people's project configuration version is higher, which is similar, just download the higher version of JDK and configure it. The solution process is as follows.

(1) The first step is to download the appropriate JDK file

     http://www.oracle.com/technetwork/java/javase/downloads/index.html (oracle official website link)

    Coupled with a link to the JDK1.7 version, I feel that this is a common point. Often the 1.8 version of the JDK encounters problems with the 1.7 or 1.6 version of the project.

    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

(2) The second step is to adjust the default JDK version of eclipse

    This step is very important, configure the JDK you downloaded in eclipse.

    Click Window->Preferences on the top toolbar of eclipse to find the Compiler in the Java column in the left menu.



    Change the original JDK version value to 1.7. Since I have already introduced version 1.7 here, there will be no warning screen at the bottom of the interface. If the new JDK has not been configured, there will be a yellow triangle with an exclamation mark in it, click "Configure.." at the end of the warning message to enter the following interface


    You can see that I have already introduced the relevant 1.7JDK, if not, click Add on the right


    Double click on Standard VM


Folder button, find the folder where you installed the JDK, and select the JRE folder in it



    Then click Finish and you're done! I have already configured it here so that already in used will be displayed at the top.

    Then remember to go back to this page to select the newly configured JDK and click Apply


    At this point, the default JDK modification of the environment is completed.

(3) Modify the project configuration

    Right-click on the project icon (the project icon is not pictured) and select Properties


    Select the original jre1.8.0-152 and click remove on the right, then click Add Library.


Click on JRE System Library 


Just complete it directly, because the default JRE has just been configured, and the system has automatically selected it for you. If you are really not sure, click on the Alternate JRE above to select the jdk1.7 version you just configured.


You can see that it has been changed to version 1.7. Next, search for project facets in the left search box to enter the following interface


    Change the 1.8 in the java column to 1.7 and click Apply!

    In fact, the high and low versions of the JDK are not always in conflict. Generally, the project JDK configuration is higher than the eclipse configuration to make mistakes. I'm also a novice, and sometimes I don't understand what the specific error is, so I simply change the JDK environment of eclipse and the configuration of the JDK in the project to one version.

    In a word, the different JDK environment versions of the project and eclipse may cause conflicts and errors. The solution is to configure the appropriate JDK!


    Finally, it is found that the use of tomcat will not be affected by the JDK changes configured by eclipse, so leave it alone.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324606242&siteId=291194637