Why do I have Java 11 in Intellij terminal? - java

I try to understand why do I have Java 11 in Intellij. When I run the java -version in Intellij terminal I get this response:
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+12-b304.10)
OpenJDK 64-Bit Server VM (build 11.0.3+12-b304.10, mixed mode, sharing)
When I run the same command from Windows command prompt I get this:
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
I really don't understand why I have Java 11 in Intellij terminal because I have these Project settings:
Modules:
Java Compiler:
And in the pom.xml:
<properties>
<java.version>1.8</java.version>
</properties>
So why do I have Java 11? I want to use Java 8. Any feedback will be appreciated.

The shell running in IDEA inherits its environment from IDEA. IDEA is itself a Java program, so whatever script or stub program started its JVM probably set the PATH so that it picks up the version 11 JDK that was installed with IDEA. When you do java -version in the IDEA shell, you get IDEA's version. But outside of IDEA, the version you get is determined by the PATH you set up in your Windows environment.

Related

Eclipse: "Could not find Java SE Runtime Environment"

I have just downloaded Eclipse and tried to run it, and it gave me this error message:
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
After closing the errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the jdk multiple times.
After following some other posts i saw, i have also made sure that %JAVA_HOME% was included in PATH
(%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version i got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
According to this answer maybe you messed up with your registry, make sure all java removed first and reinstall JRE.
For me if I want to develop java apps, I would install JDK instead of JRE, after install pls check java & javac command exist
'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment. After closing the
errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the JDK multiple times. After following some other posts I saw, I have also made sure that %JAVA_HOME% was included in PATH (%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version I got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
share edit
asked
1 hour ago
Csalagovits Máté
1●11 bronze badge edited
5 secs ago
One thing I noticed is the JAVA_HOME path refers to JDK 13, while the "java -version" command points to 1.8. Specify the version of Windows and Eclipse you have used in this question. Also, make sure you restart the PC after installing Java. – Shankar P S 52 mins ago
#ShankarPS Edited the question to adress your concerns – Csalagovits Máté 2 mins ago

How to run evosuite with(out?) jdk

I get this error when i run EvoSuite
java.lang.RuntimeException: No Java compiler is available. Are you running with
the JDK?
A bit confusing, is it asking me to run with the JDK, or is it stating that i shouldn't?
When i run java -version it gives
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
You need to have JDK installed in your machine (and not just the JRE). This is because EvoSuite needs to compile and verify the tests it generates. If you have the JDK, but EvoSuite still does not find it, try to configure the JAVA_HOME system variable to point to it

Why isn't javafx on the default classpath even when I have installed Oracle JDK 1.8?

I'm using Oracle JDK 1.8.0.45 on Kubuntu Linux which I installed following these instructions. I had to do the manual install since the automatic one didn't work.
Even with the Oracle JDK I still can't use javafx without manually setting the classpath. What could cause javafx to not be on the default classpath as it should be in 1.8?
EDIT: Java -version in terminal gives:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Unable to build Floodlight Controller Package Eclipse

I am working on using Floodlight Controller for SDN. I used
ant eclipse
to setup the Eclipse files and then changed the Build Configuration as desired in the installation instructions. I am getting the following compilation error in the package net.floodlightcontroller.util.MatchUtils:
The method setMasked(MatchField<F>, Masked<F>) in the type Match.Builder is not applicable for the arguments (MatchField, Masked)
on lines 141 and 148.
Can somebody help me with the issue?
Operating System: Mac OS X 10.10
Java Version:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
As suggested in the comments above, it works with Java SE 1.7. There is also a Github Issue.

What is the source of the discrepancy in Java versions: Java 6 (in Terminal, Eclipse) and Java 7 (in Java Control panel)?

Eclipse complains: JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse.
In the Terminal, java concurs:
> java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
But in System Preferences \ Java \ the Java Control Panel says Your system has the recommended version of Java: Java 7 Update 51
and points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java.
Eclipse preferences show that the installed JRE is at:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
To point Eclipse to Java 7 (1.7.0), it's enough to change the preference:
What is the source of the discrepancy in Java versions? Is this an instance of having different PATHs between the command-line Mac and the windowed-Mac?
Edit
If I edit /usr/local/adt-bundle-mac-x86_64/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini by adding
-vm
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
Eclipse refuses to start.
And yet this is indeed 1.7:
> "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
If you want to be certain of the JVM that is used to run Eclipse, you need to specify it in your eclipse.ini file, according to these instructions.
Installing this update might fix your problem:
http://support.apple.com/kb/dl1572

Categories

Resources