This question already has answers here:
set mac jdk version to 1.8
(2 answers)
Closed 1 year ago.
I am Currently using JDK 16 on my mac book pro so i wanted to run a fluuter project which i bought from Codecanyon and i noticed an error which i looked up and the solution was the JDK version that i need to install jdk 8 in-other to run the project, so i downloaded the JDK8 and installed but when i run
Java -version
i still get
java version "16.0.2" 2021-07-20 Java(TM) SE Runtime Environment
(build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build
16.0.2+7-67, mixed mode, sharing)
i have tried adding the file path to bash file by running
touch ~/.bash_profile; open ~/.bash_profile
and adding it to my path file like bellow
export PATH="$PATH:/Users/bright/Development/flutter/bin" export
PATH="$PATH:/Library/Java/JavaVirtualMachines
still when i run the
Java -version
i still see the version 16...
how do i set my Mac os to be seeing the JDK 8 or better still how to set it as the default JDK?
there are a few questions on stackoverflow like this.
In general to set java 1.8 as the shell enviroment try this:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
How to set or change the default Java (JDK) version on macOS?
set mac jdk version to 1.8
Related
I want to install open office in my centos linux and as part of the requirement is jdk 11.0.2 version.
I installed new version of java JDK 11.0.2 however when I use the command java -version it is still showing that it is using old version of java.
java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
i created the file /etc/profile.d/jdk11.sh and ran the command below
"source /etc/profile.d/jdk11.sh"
the file contains
export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin
Given that you are using centOS:
try the following command:
sudo update-alternatives --config java
It should show you the list of available Java versions in your system. You can switch using the numbers shown in the result of the command.
I initially installed jdk 14 and realized that was wrong. I tried uninstalling jdk 14 and installing jdk 8u instead, but while the java in system preferences says that it is running 1.8.0 terminal says it is in 14 still.
java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)
The problem with creating a java virtual machine still exists when I try to install eclipse.
Firstly you could try and configure Eclipse itself to use as described here but, to summarise here, you need to add the following to eclipse.ini
; rest of ini file...
-vm
/usr/bin/java
-vmargs
-Xms40m
-Xmx1024m
Of course tweak the memory requirements to your needs and read the full example linked to above.
Failing that you can also try and set JAVA_HOME. If you have installed a standard Java distribution on macOS then these commands could work:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) # Select JDK 1.8
# OR
export JAVA_HOME=$(/usr/libexec/java_home -v 11) # Select JDK 11
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
Mac here (Yosemite 10.10.5). I am using JDK 8 for all my projects, and recently just inherited an “older” Java 7-based project. I would simply like to download a Java 7 JDK from Oracle's archived JDKs, however it only seems to be available as a DMG (auto-installer).
I’m afraid that if I download this DMG it will auto-install it and make Java 7 my default installation. Whereas, I only want the unzipped JDK on my local file system, so that I can run my Java 7 app off of it (by specifying the full path to the JDK when I run the app locally).
Any ideas as to what my options are?
Most of the information about this can be found in Oracles notes on installation
I believe what you are looking for specifically is under
Determining the Default Version of the JDK:
There can be multiple JDKs installed on a system, as many as you wish.
When launching a Java application through the command line, the system uses the default JDK. It is possible for the version of the JRE to be different than the version of the JDK.
You can determine which version of the JDK is the default by typing java -version in a Terminal window. If the installed version is 8u6, you will see a string that includes the text 1.8.0_06. For example:
% java -version
java version "1.8.0_06-ea"
Java(TM) SE Runtime Environment (build 1.8.0_06-ea-b13)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b04, mixed mode)
To run a different version of Java, either specify the full path, or use the java_home tool:
% /usr/libexec/java_home -v 1.8.0_06 --exec javac -version
This question already has an answer here:
Installed Java 7, but interminal still Java 6 [closed]
(1 answer)
Closed 9 years ago.
Ok, I went through the steps to install Java 7 on my Macbook from http://java.com and the applet the FAQ has me run after the install to verify the version running indicates 1.7.0_17 should be what I'm running. The java console indicates the same however, it looks like both are just showing me what version of plug-in is running. When I run:
jave -version
From the terminal it is still showing 1.6.
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
When I check the JavaVirtualMachines folder it only shows 1.6 and a find from root does not show 1.7 anywhere. I'm obviously new to os x and need some guidance as to what I am missing. I need to install the 7 jdk and set it as my default for all new dev.
Thank you!
Fixed. java.com is the WRONG place to get the JDK. (I should've noticed it!) Go here instead.
http://www.oracle.com/technetwork/java/javase/downloads/index.html