Unbound classpath container in Eclipse

后端 未结 13 898
后悔当初
后悔当初 2020-11-29 19:49

I have checked out a project using Subversive for Eclipse and I am getting the following errors:

  • The project cannot be built until build path errors are resolv
相关标签:
13条回答
  • 2020-11-29 20:26

    The problem happens when you

    • Import project folders into the eclipse workspace.(when projects use different Jre).
    • Update or Reinstall eclipse
    • Change Jre or Build related Settings.
    • Or by there is a configuration mismatch.

    You get two errors for each misconfigured files.

    • The project cannot be built until build path errors are resolved.
    • Unbound classpath container: 'JRE System Library.

    If the no. of projects having problem is few:

    1. Select each project and apply Quick fix(Ctrl+1)
    2. Either Replace the project's JRE with default JRE or Specify Alternate JRE (or JDK).

    You can do the same by right-click project-->Properties(from context menu)-->Java Build Path-->Libraries-->select current unbound library -->Remove-->Add Libraries-->Jre System library-->select default or alternate Jre.

    Or directly choose Build Path-->Add libraries in project's context menu.


    But the best way to get rid of such problem when you have many projects is:

    EITHER

    1. Open the current workspace (in which your project is) in File Explorer.
    2. Delete all org.eclipse.jdt.core.prefs file present in .settings folder of your imported projects.(Be careful while deleting. Don't delete any files or folders inside .metadata folder.)**
    3. Now,Select the .classpath files of projects (those with errors) and open them in a powerful text editor(such as Notepad++).
    4. Find the line similar to <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> and replace it with <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    5. Save all the files. And Refresh or restart Eclipse IDE. All the problems are gone.

    OR

    Get the JRE used by the projects and install on your computer and then specify it..

    0 讨论(0)
  • 2020-11-29 20:33

    In an already configured workspace where it just stopped building:

    1. Right click the error
    2. Select quick fix
    3. Use workspace default JRE
    

    This occasionally happens to me when working in a shared project after updating it with the latest changes. I'm not sure why, maybe their JRE installation path differs slightly from mine somehow.

    0 讨论(0)
  • 2020-11-29 20:36
    1. right click on the project folder go to Properties at bottom
    2. go to Java Build path
    3. click on Libraries tab
    4. select Classpath
    5. click Add Add Library button on right
    6. select JRE System Library and click Next and then Finish
    7. click Apply and Close the error should go away in IDE.
    0 讨论(0)
  • 2020-11-29 20:37

    Indeed this problem is to be fixed under Preferences -> Java -> Installed JREs. If the desired JRE is apparent in the list - just select it, and that's it.

    Otherwise it has to be installed on your computer first so you could add it with "Add" -> Standard VM -> Directory, in the pop-up browser window choose its path - something like "program files\Java\Jre#" -> "ok". And now you can select it from the list.

    0 讨论(0)
  • 2020-11-29 20:41

    Given the FAQ, sharing a project file seems have to have advantages and is even recommended practice for Java projects (personally, I would not do that).

    Maybe some of the following work for you:

    1. Edit the project's properties (right-click project, Properties, Java Build Path, Libraries, Remove and Add Library.
    2. Import the project's files without the "project file"
    3. Install JDK1.5 from http://java.sun.com/javase/downloads/index_jdk5.jsp and see whether you can fix paths
    0 讨论(0)
  • 2020-11-29 20:41

    To fix this:

    • Right click your project –> Build Path –>Configure Build Path
    • Select JRE Library and click Edit and from Edit library window choose alternate JRE whatever been configured with your eclipse then click Finish
    0 讨论(0)
提交回复
热议问题