I have a simple java project and I try to change java version in Intellij from java 11 to java 8. It isn't a maven project. I found something on google and it looks easy, but it's not working.
So, I pressed ctrl + shift + alt + s and here I changed jdk11 with jdk1.8:
But now if I run java -version on Intellij terminal I get this in the console:
java version "11.0.14" 2022-01-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.14+8-LTS-263)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.14+8-LTS-263, mixed mode)
It looks that it continue to use java 11. What else should I do?
Thank you!
Changing the JDK in IntelliJ UI does not affect its Intellij terminal:
When changing the JDK, we need to remember that this only affects the JDK used by IntelliJ. Therefore, when running the Java project via the command line, it'll still use the JDK specified in the JAVA_HOME environment variable
So when running java on Intellij terminal, you still have to set JAVA_HOME to change java version
Related
I use macOS Sierra. When I do:
java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
it seems that my java version is 1.6.0.
But when I look at System Preferences I find that my version is Java 8 Update 144. I want to use an R package that needs Java >=8.0. What have I done wrong?
The Java found in your command line is the one used to compile when using command line, first, try export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) then check if the correct version shows up using java -version if not reinstall the newest java and run the command again
I want to make a python-android-app using this software. I have installed java JDK, when i run java -version i get:
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
However running the line python android.py installsdk from witin rapt directory (as described in the tutorial) tells me that i have no JDK:
I'm compiling a short test program, to see if you have a working JDK
on your system.
I was unable to use javac to compile a test file. If you haven't
installed the Java Development Kit yet, please download it from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
The JDK is different from the JRE, so it's possible you have Java
without having the JDK. Without a working JDK, I can't continue.
You need to set your jdk to be accesible, and within path / java home :)
Here help from google:
To set JAVA_HOME environment variable, do the following: Launch
Terminal by pressing Ctrl + Alt + T on your keyboard. Depending on
where you installed your Java, you will need to provide the full path.
For this example, I installed Oracle JDK 7 in the
/usr/lib/jvm/java-7-oracle directory.Aug 13, 2012
I recently updated my java version to "Java 8 update 77".
As far as i know, this is the newest version...
My Java Control Panel prints the same information,
but when i switch to terminal to verify the java version:
java -version
it outputs:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
When i type:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
it prints correctly:
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
So, did i anything wrong?
Why are there two different versions listed ?
Thanks and Greetings!
When Java is updated, it doesn't override the older version. It keeps the older version and also installs new version.
You have to change your $JAVA_HOME environment variable if you want to use new version.
This Link May help
Open the terminal. Type...
nano ~/.bash_profile
Search for export JAVA_HOME. When you find the line, comment it out by placing a # in front of the line.
Type on the next line...
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
assuming that is where the jdk is. Press ctrl+o, ctrl+x.
Type source ~/.bash_profile. And you should be all set.
The second option that you have written about is where you are checking the java applet plugin version which does not need to be the same as the jdk runtime environment.
To make your .bash_profile future proof, you can try this
export JAVA_HOME="$(/usr/libexec/java_home)"
The thing is i have jdk1.6.0_45, jdk1.7.0_09 installed on my computer.
Normally i use JDK7 as my work environment with following system variable setting:
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_09;
classpath=%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
path=%JAVA_HOME%\bin;
And when i execute java -version in cmd, it displays the version correctly:
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
Here i encounter a problem, i need to switch to JDK6 for another project. So i changed system variable JAVA_HOME to C:\Program Files\Java\jdk1.6.0_45, i supposed that it should works for the new setting. But actually not, when i executed java -version, it still shows the currently using jdk is 1.7.0_09.
Is this alright?
Finally i found what the problem is.
There is a java.exe(which is jdk7) under system32 folder.
The full path system variable is path=C:\Windows\system32;%JAVA_HOME%\bin;. Which means the unexpected java7 will always be the selected version on my computer even i have specified another version(like jdk6). It might came along with some browser plugin/applet. When i removed this java.exe, everything goes fine.
Trying to install Sencha Command 3.1.1 on my iMac (10.8.3). The installer is saying:
The installer could not find a valid Java(tm) on this machine.
Supported versions: Vendor : Any min. 1.6.0 max. any
Following another Stack Overflow thread, I tried linking /usr/bin/java to /Library/Internet Plugins/JavaAppletPlugin.plugin/Contents/Home/bin/java. Now, I get this on the command line:
~ 🍔 java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
So that looks good, but the installer still complains that it cannot find Java. Why can't it?
What eventually fixed this for me, after consulting with Sencha support, was installing the full JDK rather than just the JRE. I don't know exactly why this fixed it, or what the root cause was, but now Command installed successfully and is working fine.
I had JDK installed, but one thing worked for me was exporting $java_home/bin:
export PATH=$JAVA_HOME/bin:$PATH