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

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

Related

Unable to find a javac compiler com.sun.tools.javac.Main is not on the classpath error

I am trying to run java application and I am getting following error,
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
I have gone through many SO questions and found solution is JAVA_HOME should be point to JDK, not JRE.
Then I have tried to print JAVA_HOME in command prompt,
I had set this JAVA_HOME from my computer->properties->env variables -> system vars as below,
I had also added new variable in eclipse using preferences as,
And finally I am still getting the same error. Whats wrong with JAVA_HOME ?
Update :
In eclipse-preferences-installed jres there is only one entry is present and which is jdk and selected,
And under project properties java build path-libraries there is JRE System Liberary [jdk1.8.0_31] is used.
Update 1 :
C:\Program Files\Java\jdk1.8.0_31 have folder named jre. Is that jre folder causing this issue ? Can I remove this folder ? Is there is any way to add only jdk liberary in project ?
Eclipse is an IDE and as such, it has (at least) two Java versions: The one which it uses itself to run (JAVA_HOME) and a JVM which it uses to run your application. The two don't need to be the same.
So to fix your problem, you need to look into Eclipse's preferences, specifically Installed JREs which gives you a list of Java VMs which Eclipse will use to run Java code from projects. My guess is that there will be several entries there and the default will be a JRE instead of a JDK.
Make sure you have a JDK in the list and then go to your project. In the project, you can select which Java VM to use under Java Build Path -> Libraries.
[EDIT]
Look closely at the last screenshot: You've configured Eclipse to use C:\Program Files\Java\jdk1.8.0_31\jre which means you've pointed it at the JRE inside of the JDK. Use C:\Program Files\Java\jdk1.8.0_31 instead (without the \jre at the end).
[EDIT 2] If you delete the jre folder, Java will stop working. Any JDK also contains a JRE. The JRE contains rt.jar with String.class and the like. The Java compiler is in tools.jar which is in the JDK.
If recreating the JRE entry in Eclipse doesn't help, you'll have to add it manually to the classpath.
You can use a variable ("Add Variable...") to make sure Eclipse updates the path when you switch to a new/different JRE. Try JAVA_HOME with the extension lib/tools.jar
In Eclipse click Run->External Tools->External Tools Configurations
Click JRE tab
Click Installed JREs... button
Click Add button (select Standard VM, where applicable)
Click Directory Button
Browse to your JDK version (not JRE) of your installed Java (eg: C:\Program Files\Java\jdk1.7.0_04)
Click Finish.
Re-run Ant script - have fun!
I faced the same issue while i was using ant from command prompt and the solution which I found is that you need to put tools.jar inside bin folder which is present inside apache ant folder.
For eg :-
D:\apache-ant-1.10.12-bin\lib
You will get tools.jar inside
C:\Program Files\Java\jdk1.8.0_211\lib
Please change the path based on your java installation path.

Java configure build path

I have just installed Eclipse Indigo, and created a new project. It's telling me that the build path is not configured.
I have followed RighClick on the project -> Build Path -> Configure Build Path -> Libraries and there I found JRE System Library [jre1.8.0_31] and I don't understand why it doesn't recognize it.
Any help?
First of all you have to know some stuffs about JAVA. Java uses a JVM (Java virtual machine) wich is the JDK and need to be installed on your computer.
The JDK makes the JVM run and the JRE allow you to compile etc java class. (No need for both, just install the JRE)
see this page.
Then you'll have to configure a window GLOBAL VARIABLE. The JAVA_HOME var.
"1-Right click My Computer and select Properties.
2-On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located".
This way Eclipse will be able to find the installed JRE.
Finally, in eclipse, check that it know the JRE.
And that's it. There is a lot of info over the web about this for more details.

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 configure JDK as the default JVM in my workspace

Im trying to create a new grails project using the IDE GGTS (groovy and grails tool suite )
but it says that grails needs a JDK and JRE is not enough , I already installed JDK 1.7 and added the JAVA_HOME to the path
i also copied the grails folder and added a GRAILS_HOME to the path
in GGTS :
i tried In Window>Preferences>Java>Installed JREs to check JDK1.7.0_51
and
In Window>Preferences>Java>Installed JREs>Execution Environments I choosed JavaSE-1.7 and checked JDK1.7.0_51[perfect match]
the JDK installed is 64 bits and My PC is windows 8 64 bits
but the error persists
We have to make sure that the Java run time of our eclipse IDE points to a JDK instead of a JRE. Here are the steps:
Go to Window->Preferences
Edit Installed JRE if it is pointing to a JRE installation
Change it to the JDK installation directory. It is better if you also change the name

Groovy and grails jdk issue

I wish I could give you guys more information on what's going on, but I really have no idea. I am trying to install groovy and grails tools suite from springsource and I am having trouble configuring it to work properly. I have the most up to date JDK, and the preferences show it, but I still get warnings and it does not build. I have posted some pictures below to show what is going on.
on your GGTS go to window
select java
select installed JREs
add-> Standard VM
jRE home select directory up to C:\Program Files\Java\jdk1.6.0_18
select jdk1.6.0_18 from installed JREs
I faced a similar issue (I am sure it is the exact issue) - Here are the steps to ensure it works correctly, I struggled with initially but this got it going.
Install JDK from http://www.java.com ,in a directory where there are NO SPACES in the path
Set JAVA_HOME to your JDK installation
Ensure %JAVA_HOME%\bin; is in your PATH variable.
On the command prompt run java -version, it should give you the path where JDK is installed
Install STS Springsource Tool suite.
Run your STS and create a new grails project and run it.
Let me know if that does not work.
It might be that you are launching Eclipse with a JRE even though you have a JDK installed as one of the compilers in your workspace. To find out if you are launching with a JRE or JDK, go to Help -> About GGTS -> Installation details -> Configuration
Look for the -vm option and make sure it is a JDK not a JRE.

Categories