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

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

Related

WildFly (JBoss) Integration with Eclipse

I am currently trying to integrate WildFly and Eclipse JEE Oxygen 3 with WildFly12.0. I am getting an error I don't understand nor can I find a fix. When in the new server I get the following on the last step: "No valid JREs found for execution environment "JavaSE-1.8" "
Thanks in advance!
You need to add JRE 1.8 to your installed JREs and then use it on the build path of your project.
Window -> Preferences -> Java -> Installed JREs -> Add
Then add this JRE to your build path
Right click on your project
Build path -> Configure Build Path
Go to Libraries tab
Add Library -> JRE System Library
Choose JRE 1.8

Installed JRE/JDKs are not shown on Eclipse Mars' Execution Environments

I've just installed Java EE Eclipse Mars, with a JDK 8u45 x64 and JDK 7u79 x64 JDKs. My eclipse.ini file is pointing the -vm option to my Java 8 JDK Home: C:\ambiente_mars\jdk8u45x64\bin\javaw.exe.
When I started Eclipse and was configuring my environment I started to set my Installed JREs like this (and like I've done since Indigo):
My Compiler Settings are configured this way:
After all this, I went to Execution Environments to choose the right VM for all the environments, but my configured JRE's are not there:
Actually, this JRE is not shown for any of the Execution Enviroments <= JSE 1.7. This very same screen, but now on Luna shows everything right, so I think I'm not doing anything wrong.
Maybe this is a bug? Can someone point another way to do it?
Thanks a lot in advance, lads!
Edit 1: Eclipse is x64 too. Thought it would be good to remember ;)
Try this: click "Search.." on item "Installed JREs". Choose your java folder.
Default is: c:\Program Files\Java\
I had this problem while looking into issues with an Eclipse (Neon .1) installation yesterday.
After trying plenty of different things, we spotted that the machine had both the environment variable "JRE_HOME" set to a JRE that wasn't the one running eclipse, and a _JAVA_OPTS (global java settings override) environment variable set. When we took both of these out, the execution environments finally started being found!
Unfortunately, we removed both at once, so I can't say which of the two it was, but it's another thing you could try changing.
First , you have correclty added the JDK(JRE) in your Eclipse , but the execusion environement changes from a project to an other and in the same workspace , that means , you have to right click on your project => Build Path => Configure Build Path => Libraries Tab you will find JRE System library [JDK...] => you click on and you click on Edit button then you can select the installed JDK in your machine.
Also in eclise.ini for eclipse or jbdevstudio.ini for Jboss developper Studio you set the full path of you installed JDK as a default vm
This is an example :
-vm
C:/Program Files (x86)/Java/jdk1.7.0_51/bin/javaw.exe
About the JAVA_HOME you can modify if by making you default JDK.
Hop that is useful for you.
Click on windows → preferences → java → Installed jres
Check jdk with version available or not
If available just tick the jdk checkbox and then goto execution environment and select javaSE version and then Compatible jre section add jdk
If not available click on add → select standard VM → in place of jre home add jdk bin folder path and click on apply → tick on jdk
then goto Execution environments and select javaSE version and then Compatible jre section add jdk

what broke up in my eclipse?

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.

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 use Java 8 docs in Eclipse

I'm having issues seeing API documentation for Java 8 in Eclipse. Here's an example of the problem I'm having
Calendar myCalendar = Calendar.getInstance();
If I mouse over Calendar then I see all the correct documentation, however if I mouse over getInstance() I get a message saying
Note: This element has no attached source and the Javadoc could not be
found in the attached Javadoc.
I have the Javadoc location for rt.jar set to http://docs.oracle.com/javase/8/docs/api/, I've also tried downloading a local copy of the docs and had the same problem. Changing the link to the Java 7 docs fixes the problem I'm having.
Eclipse seems to be using the wrong anchor style (not sure how else to word it) when looking for methods. When it looks for the getInstance() method, it checks http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance(), but it should be checking
Calendar.html#getInstance--
All brackets and commas seem to have been replaced by hyphens in the Java 8 doc links. I experienced this problem with Eclipse 4.3 (Kepler), 4.3 with the patches for Java 8, and now with 4.4 (Luna)
Is there a way to update Eclipse so that it properly displays the docs in the mouse over tooltips?
Setting the installed JRE to JDK 8 fixes your problem.
This can be done by going to
Window -> Preferences -> Java -> Installed JRE -> Edit -> Directory and selecting the JDK 8 installation folder
Step 1: Windows -> Preference -> Java -> Installed JRE -> Edit -> Directory (Specify the JDK directory (and not JRE))
Step 2: Click "Restore Defaults"
Step 3: Click OK
This worked for me in Ubuntu 14.10, Eclipse Kepler using openjdk-8
Window > Preferences > Java > Installed JREs > Click on your java-8-openjdk > Edit
For /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:
set Source attachment to:
/usr/lib/jvm/java-8-openjdk-amd64/src.zip
set Javadoc location to:
file:/usr/share/doc/openjdk-8-doc/api/
NOTE: If you don't already have the openjdk-8 java doc, install:
sudo apt-get install openjdk-8-doc
and for the source:
sudo apt-get install openjdk-8-source
I had the same problem. I did set the installed JRE to be JDK8. Still wasn't working until I clicked "edit" on the jre (under 'Installed JREs') then then clicked "Restore Defaults". Then it started working... Looking at each jar in that list I see it sets "Source attachement" and not "Javadoc location". Seems to work.

Categories