what broke up in my eclipse? - java

For some reason, whenever I create a new Java project, I can't compile anything and I get the following errors:
The project cannot be built until build path errors are resolved
Unbound classpath container: 'JRE System Library[OSGi/Minimum-1.2]' in project 'MyProject'
This didn't use to ever happen, and it used to be very easy to create new Java projects.

Open Properties by Right clicking on your project
Select Java Build Path
Under the Libraries, select JRE System Library under the Libraries.
Then click Edit...
select Alternate JRE under System library
If any, select JRE from the drop down and click finish
If none, click installed JREs...
Under installed JRE Types, select Standard VM, and click next.
Set your JRE home and JRE name and click finish.
Under the install JREs select your newly added JRE and click OK
After that, Repeat step 6.

1.Check whether JRE is properly installed in your system and it is added in Eclipse.
You can try re-installing JDK in your system and
Add JRE to Eclipse from Window -> Preferences -> Java -> Installed JREs.

Related

i am not able to find jre in eclipse even if install jdk in OS

i am new to eclipse wants to set up jdk (jre) in my project. i have installed jdk in my OS.
[![here is java version][1]][1]
[]: https://i.stack.imgur.com/gKqbh.png
please can help me in this to resolve this . thanks in advance
You can add your installed JDK to the Eclipse by following steps:
Right click your project > properties
Select “Java Build Path” on left, then “JRE System Library”, click Edit…
Select "Workspace Default JRE"
Click "Installed JREs"
If you see JRE you want in the list select it (selecting a JDK is OK too)
If not, click Search…, navigate to Computer > Windows C: > Program Files > Java, then click OK
Now you should see all installed JREs, select the one you want
Click OK/Finish

Unbound classpath container : 'JRE System Library in project 'HelloWorld'

I just installed Eclipse + Java and trying to make my first HelloWorld project.
But I have this error message after creating the project.
I have read the many posts but it does not help me, because I do not even have a JRE installed in my Eclipse,
See my screenshot.
What can I do?
Where to find the JRE?
I have already installed the JDK.
Thanks
I notice you haven't installed any JRE - which is probably your problem.
Download the version (example here 1.8) from Oracle.
Then on Eclipse, try:
Window -> Preferences -> Java -> Installed JREs -> Add
And follow the guide to your previously installed JRE.
Then go to:
Window -> Preferences -> Java -> Compiler -> Compiler compliance level
Ensure that matches the installed JDK.
In your screenshot click the Add... button
Select Standard VM and click Next >
Enter the installation directory of your Java 8 JRE (or better JDK) and click Finish

how to set specific system JRE due to Eclipse project?

I imported Java project from SVN and want to run it without changing the classpath. I installed JDK 8 (java -version shows
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
), but on the project I see error:
Unbound classpath container: 'JRE System Library [JavaSE-1.8]' in project
I also added "Standard VM" in Window -> Preferences -> Java -> Installer JREs, but it didn't help.
I guess I have to set my system JRE exactly to JRE which is set in the project. But as far as I understand, it's the save version...
You can provide project specific JDK/JRE by right clicking on project and then select configure properties. There you can update java compiler.
Look in the Preferences in 'Java > Installed JREs > Execution Environments'.
Click on 'JavaSE-1.8' and select the JRE to be used.
You can select it on run configuration. Then, click on your run option, and then select JRE overlap.
this example is for eclipse

JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse

I have 3 versions of Java installed on my system: 6, 7, and 8... I am required to have JRE6 available for a product my company develops, so I cannot get rid of it... But despite copying my Eclipse install to a new folder for another project I need to work on and removing JRE6 from this version alltogether, I still cannot get it to work.
How can I get the google plugin for Eclipse to work in my scenario?
If you have created a shortcut to start eclipse, you can add a parameter to tell it to use the jre of your choice like this -
C:\eclipse\eclipse.exe -vm "C:\Programs\jdk\jdk1.7.0_55\bin\javaw.exe"
I have used "javaw" executable from a jdk installation, but you may point to the same executable within a JRE installation as well.
This will resolve the error.
Keep in mind that there is a separation between the JVM that Eclipse itself is running in and the various JREs that you can configure in Eclipse to run your programs/applications. You need to specify to Eclipse what JVM you want it to run under, using eclipse.ini.
That's separate from the Installed JREs configuration you show in your screen shot above.
Add Java 7.0 to Eclipse if you haven't: Window -> Preferences -> Java -> Installed JREs.
Next add Java 7.0 library to your project: Right click on project -> Properties -> Java Build Path -> Libraries tab -> Remove JRE 1.6 and add New Library (JRE System Library, 1.7.0).
Last set Java 7.0 compliance level: Right click on project -> Preferences -> Java Compiler -> Compiler compliance level: 1.7
Also since you can use different Java to run applications, you also have to change this in the Run configuration which you use to start AppEngine related tasks.

How to change JDK version for an Eclipse project

I need to write a project that's only compatible with Java 1.5. I have Java 1.6 installed. Is there some form of backwards compatibility to get Eclipse to compile with 1.5?
Do I have to install Java 1.5 to get it to show here? Or maybe there is another way?
.
Click on the Add Library button. It brings your screen to point to the Java location.
Select "Directory", button right besides JRE home and point to the installed folder location.
Even though you want to just 1.5 compiler project, you can achieve it by changing compiler settings in Eclipse instead of removing 1.6 JRE and add 1.5 JRE.
GOTO -->JAVA--Compiler---> and change compiler level to `1.5` instead of `1.6`
As davidfmatheson suggested,
Just be careful, especially if you're setting this up for a team of people to work on. If anyone uses anything that is new or changed in 1.6, it will compile, but not run in an environment with JRE 1.5.
Click on the Window tab in Eclipse, go to Preferences and when that window comes up, go to Java → Installed JREs → Execution Environment and choose JavaSE-1.5. You then have to go to Compiler and set the Compiler compliance level.
Right click project -> Properties -> Java Build Path -> select JRE System Library click Edit and select JDK or JRE after then click Java Compiler and select Compiler compliance level to 1.8
If you are using maven build tool then add the below properties to it and doing a maven update will solve the problem
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
In the preferences section under Java -> Installed JREs click the Add button and navigate to the 1.5 JDK home folder. Then check that one in the list and it will become the default for all projects:
Eclipse - specific Project change JDK Version -
If you want to change any jdk version of A specific project than you have to click ---> Project --> JRE System Library --> Properties ---> Inside Classpath Container (JRE System Library) change the Execution Environment to which ever version you want e.g. 1.7 or 1.8.
The JDK (JAVA_HOME) used to launch Eclipse is not necessarily the one used to compiled your project.
To see what JRE you can select for your project, check the preferences:
General → Java Installed JRE
By default, if you have not added any JRE, the only one declared will be the one used to launched Eclipse (which can be defined in your eclipse.ini).
You can add any other JRE you want, including one compatible with your project.
After that, you will need to check in your project properties (or in the general preferences) what JRE is used, with what compliance level:
(source: standartux.fr)
See the page Set Up JDK in Eclipse. From the add button you can add a different version of the JDK...
As I was facing this issue minutes ago, in case you are trying to open an existing project in an environment with a newer JDK, make sure you pdate the JDK version in Project Properties -> Project Facets -> Java.

Categories