Unbound classpath container: 'JRE System Library [OSGi/Minimum-1.2]' in Eclipse Juno - eclipse

For my class I imported code from an online source given to us by the professor and tried to run it in Eclipse Juno (i'm not sure if it makes a difference what version) And I got the error message "Unbound classpath container: 'JRE System Library [OSGi/Minimum-1.2]' in project 'cs112'" I researched several answers to this problem and tried multiple solutions including building a path and adding a library, which i named JRE, and setting the correct execution environment! What could I possibly be doing wrong? Please help!!

In the Preferences (Menu Window, Preferences), find "Java", "Installed JREs".
You should have at least one JRE, better a JDK available.
Then, in the same section, there's a sub-section "Execution Environments".
The project you're trying to use asks for "OSGi/Minimum-1.2". The "Execution Environments" preference section allows you to view and adjust how the available JREs are mapped to requested execution environments. If none of your JREs are listed as compatible with the requested environment, you may have to
Install a new JRE or JDK, for example a recent Java 1.7
and, this is important, tell Eclipse about that new JRE by adding it to the "Installed JREs". Select "Add" -> "Standard VM" -> Point to "jdk1.7.xxx".

Related

Eclipse 2022-06 (4.24.0) does not recognise Java 17

I want to move to Java-17, from Java-11.
Updated Eclipse to 2022-06 (4.24.0).
Eclipse clearly says that Java-17 is the selected JRE.
Entered an example with Text Blocks to test Java-17 features.
Eclipse says: "The Java feature 'Text Blocks' is only available with source level 15 and above"
Eclipse advises:
Set project compiler compliance settings to 15
Set project JRE build path entry to 'JavaSE-15'
In Windows/Settings everything shows v17.
In desperation I removed all other Java version from my Windows machine. Didn't help.
In the terminal window of Eclipse I CAN compile and run the TextBlock example, so JRE-17 is correct. It is that Eclipse seem to be unable to handle JRE-17.
Any suggestions?
Thanks in advance!
The message is referring to the project's own Properties dialog's Compiler Compliance page. Projects can, and often do, override the workspace's settings so that they're retained in source control.

Eclipse is saying "Missing builder" and there's no way to configure it

I'm trying to configure my projects to build with jdk 1.6. The problem is that when I removed 1.7 from my computer, my projects show up as having "Missing builder (org.eclipse.vjet.eclipse.core.builder). And trying to build them shows "The specified JRE does not exist"
There's no option to configure which JRE to use in the builders, when I select the one that says missing, "Edit" is greyed out.
How can I fix this so my project can build?
Stack Overflow won't let me post images directly, so here are the links to them, as hosted on imgur.com:
The Missing Builder comes from not having VJet installed. You can disable or remove the reference to it from the shown Property Page, or just install VJet. The other you might resolve by going to the Installed JREs preference page and making sure all of the values are correct, and then fixing any existing launch configurations (Run->Run Configurations...) that may be pointing to JREs that aren't around any more (such as by changing them to use an Execution Environment instead of a specific JRE by name).

Tools jar does not exist Eclipse JAVA

The archive: C:/Java/jdk1.6.0_26-32/lib/tools.jar which is referenced by the classpath, does not exist.
This is the error I have when run Tomcat. There was no problem cleaning or publishing - only when i start the Tomcat server.
Now, I checked my folders and there is a tools.jar in file path C:\Java\jdk1.6.0_34\lib
What am i missing?
using jre6 and have jdk1.6.0_34 installed
I found this question trying to build my project using Ant in Eclipse, and I would get the same error message as above. The suggestions in #Parth's and other answers to edit the Installed JREs is the first step. What I also needed to run Ant successfully was
Right click on build.xml, select "Run As", select "Ant Build..." (note the ...)
Click on the JRE tab
Change the Runtime JRE to the same thing that you updated in the first stage, and press Apply. (That is, the runtime JRE as you specified by "Preferences" -> "Java" -> "Installed JREs", as in #Parth's answer.)
Otherwise it seems that Ant will still try to build with the old JRE that doesn't have tools.jar. Hope this helps someone.
Right click on your eclipse project, In Preferences go to Java > Installed JREs, select your JDK and click on Edit. In the new Dialog you can add external jars like tools.jar to your execution environment.
I found the solution to resolve this.
Go to Run Configurations > classpath and under User Enteries you will have tools.jar and its path would be pointing to the old folder. Remove that and click on "Add External Jars" to add the tools.jar from the new path. And that is it.
This worked for me on Eclipse:
Windows -> Preferences -> Select Java -> Select Installed JREs -> Add
-> Add your JDK -> Establish it as default -> Apply -> OK.
After this, I've to establish project related settings too:
Right click on your Project Name (in Project explorer ) -> Properties ->
Java Build Path -> Click on JRE System Libraries -> Edit ->
Select Workspace Default JRE (jdk included above)
Check your "run configurations" (Eclipse Menu Run -> Run Configurations ....) also, since therein the classpath may be wrong or has gotten obsolete.
Tomcat needs a full JDK/SDK to run but under C:/Java/jdk1.6.0_26-32/, you only have a JRE installed.
Cleaning and deploying is done by Eclipse, no Tomcat code is involved so this works.
You need to configure your environment so that Tomcat uses C:\Java\jdk1.6.0_34 as Java VM. Check the values of JAVA_HOME and the content of setenv.bat
Right click on project->Properties->Compiler->Configure workspace settings->go to configure->installed jre->give jdk path
In my case with using ANT build I had to change the setting
Add tools.jar in the below location.
Windows --> Preferences --> Ant --> Runtime --> Global Entries.
In my case the Tomcat server in Eclipse has been created under older JDK (just a few builds). My solution was to remove the sever and add it again (now using current JDK).
I had the same problem (I can reproduce it) and my solution sounds like the integration in Eclipse is really screwed up but I actually fixed it by starting Eclipse with the same JDK version.
Add/edit the following in your eclipse.ini (which is in the Eclipse directory):
-vm
path/to/jdk/bin
Where path/to/jdk/bin is the path to the JDK bin directory of the version you are using for ant/tomcat.
Note that tools.jar is NOT included in a JRE distribution.
If you are running Ant build file and getting this error in eclipse, then your eclipse is configured to use two differently named JRE's. i.e. One from the jre folder and another jre from inside the jdk's folder. Adding tools.jar may be a workaround but I used the JRE inside the JDK's folder(C:\Program Files\Java\jdk1.8.0_121). Inorder to change this,
Check in Installed JRE section which JRE is cheked(I had jdk1.8.0_121 checked and jre1.8.0_121 left unchecked).
Update your eclipse classpath by navigating to Window > Preferences > Java > Installed JRE > Execution Environments.
Now select the JavaSE-1.x on the left side and select the compatible JRE[perfect match]. Select the same JRE(jdk1.8.0_121) you had it checked above and click Ok. Optionally you can delete the JRE(jre1.8.0_121) which is unused to avoid confusion if it is not used in any other projects.
Now your project will build and you can run the Ant build files. Check the image below.
Try to add the tools.jar as an external JAR.
For eclipse,
Right click the project name and select Properties
Go to Java "Build Path"
Select tab "Libraries"
Click "Add External JARs"
Select the relevant .jar file from the file selection
I am not sure it applies to all situations, but if you right click Ant script and there is an item "External tools configuration" under "Run as" menu, select it, and go to JRE tab. As far as I can say, it may be configured independently from your project and point to the JRE, not JDK, in which case there would be missing tools.jar
I remove server (Tomcat 6.0) from window -> preferences -> server -> Runtime environment.
And add again. Then, I add my project to server again. The problem is destroyed.
If You are getting this error while running the ANT build then follow the below steps.
In the Eclipse go-to window-> preferences-> ANT-> RUNTIME
then select classpath tab then select Global Entries and add tools.jar as an external jar.
Run the ANT build.

Ant "JAVA_HOME does not point to the JDK" - but it does

I cannot run my Ant build.xml since I updated to java 1.7.0_52 (or there about). I have been running it for years through Eclipse locally on my Windows 7 laptop - but with this latest jave jdk update somethings different (?).
BUILD FAILED
C:\workspace\WaterAspectsModel3\build.xml:329: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "D:\Morten\Java\jdk1.7.0_52"
This is my jdk! So JAVA_HOME is pointing to a jdk (as is also clear from the error message). I have my JAVA_HOME with bin folder in my path as always. I've configured Eclipse - external tools configuration - with a JRE pointing to the same D:\Morten\Java\jdk1.7.0_52 (through "Separate JRE" setting). And I've tried a number of other configurations - all without luck.
I've been reading the tonnes of answers on lists here and other places and think I've tried all suggestions. Most seem to be cases where JAVA_HOME actually points to a jre and just needs to be corrected to jdk or there's a ";" in the path or something like that. None of these seem to apply in my case.
Any suggestions?
I was having the same message when running ANT through Eclipse.
What worked for me:
In Eclipse, access the menu: "Window -> Preferences";
Access "Ant -> Runtime", at the tree;
Access the Classpath tab;
Expand the "Global Entries" item;
Inside Global Entries, the path to tools.jar was wrong. It was pointing to an older version of Java;
I removed the wrong entry and added the correct one with "Add External Jars" button. It worked.
The solution
"Had to copy C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar to C:\Program Files\Java\jre6\lib\ext" from here was great helpful and worked for me.
The real message is that Ant can't find com.sun.tools.javac.Main.
Which, together with the fact that the latest "Sun" (Oracle) JDK is 1.7.0_13 (or maybe _14, but definitely not the "_52" that your install dir indicates), makes me think that you're not using a distribution that Ant recognizes. You can verify this by running jar tvf $JAVA_HOME/lib/tools.jar, and looking for that class.
The Ant Manual talks about ways to work with different compilers. Since I've only used "Sun" compilers, I'm afraid that I can't give you any pointers.
Edit: you could also try setting fork="yes" in your build file. This should run the compiler executable rather than trying to invoke the compiler class.
Try adding JAVA_HOME\bin to your env PATH .
Add JAVA_HOME to Eclipse-Preferences-Java-Build Path-Classpath Variables.
Sorry for the unearthing,
I had the same problem, my solution doesn't need any modification in environment variables, and works for a recent JDK where the tools.jar can't be found.
Just go in the small down-arrow next to the ant run button
Then click "Configure external tools"
Then in JRE tab
Select a JDK installed on your computer, not a JRE, no problems if the selected JDK is not the same JDK/JRE as in your project.
It should be work now.

Eclipse on Mac, getting "Specified VM install not found" error when trying to build

When I try and do an Ant build on my mac (Snow Leopard, Eclipse 3.6 - Helios) I get an error dialog that says
"Problem Occured"
'Launching projectName build.xml' has encountered
a problem. Specified VM install not
found: type Standard VM, name jdk1.5.0_14
I can't even find any preferences setting in Eclipse that specifies for it to use jdk1.5.0_14.
When I went into my preferences and went to the Java section and looked at the Installed JREs, the only one I have specified is 1.6.0. Where is it getting the setting to try and use 1.5? (Or am I barking up the wrong tree?)
Your ant project launcher refers for some reason to a Java 5 environment.
Select "Run as -> Configurations" and locate the ant build. Then indicate you want this configuration to run with a Java 6 JVM.
Delete the
".metadata.plugins\org.eclipse.debug.core.launches\ build.xml.launch" file and problem is solved".
This is just an update of the previously posted solution for later versions of Eclipse, like STS.
If your Ant View is open, R-click on the root (otherwise Run -> External Tools -> External Tools Configuraitons)
Run as -> External Tools Configurations ...
Your Ant launch should be selected in the External Tools launchers, if not selected manually
Go to the JRE tab
Select Run in the same JRE as the workspace - you can also select a different JRE using the buttons on the right.
Re-run your ant task(s) - this time you will not get the error message.
There was a whole bunch of stuff I had wrong that I changed to fix this, but I believe the crucial piece was an %ATG_HOME%/home/localconfig/dasENV.sh file had an ATGJRE a path that was incorrect.
I kept getting "Specified VM install not found: type MacOS X VM, name Java SE 6...".
And i did this accidentally and it worked: Properties-Java Compiler-Installed JREs-Search Button.
It did some soul searching,created yet another JRE entry and it all worked!
Right click on the project and choose properties.
Go to Java Compiler and make sure Compiler compliance level is set to 1.6 rather than 1.5.
I think that should do the trick.