How to replace java6 with java8 in Mac OSX? - java

I hava install java8
but java -version output:
java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
How to use latest version?
Thanks.

Check out this how-to to change your java home path to the java 8 home

Use this command to update JAVA_HOME variable:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Related

How to set Java -version is returning jdk instead if java

Hello I installed java on my MacOS but its not working as expected.
When I do java -version below is the output I am getting instead of right version number:
abc#xxxxx ~ % java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15+36, mixed mode, sharing)
I see this is want installed under system and user:
Expected Output:
1234$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
Perhaps you should fix your JAVA_HOME.
Here's the easiest way I know. Just add this to your ~/.bash_profile and ~/.zshenv:
export JAVA_HOME="$(/path/to/your/java)"
Then restart your terminals/IDEs.

What is my real Java version on macOS?

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

Installing eclipse mars on Linux

I just downloaded the linux 64 bit tar for eclipse mars. When I try and run the installer it gives me the following message
Version 1.6.0_31 of the JVM is not suitable for this product.
Version: 1.7 or greater is required.
I am on java version 1.8. See
$java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Where does it get the 1.6 version of java?
.cshrc.mine
setenv $JAVA_HOME /path/to/Java8
setenv PATH /path/to/Java8/bin/:$PATH
Also
$ java -XshowSettings:properties -version
Property settings:
// Other props
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_65-b17
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Try specify the JDK/JRE path by adding the following two lines into the beginning of your eclipse.ini file:
-vm
[your-path-to-java-executable]
In your eclipse.ini file you should point to java8
-vm
/opt/jdk18025/bin/javaw.exe

PATH struggling

simple question. I got JDK 1.7 and 1.8 on my pc (Windows). I need both them. I got a "%JAVA_HOME%\bin;" entry in my PATH (JAVA_HOME=path_to_my_jdk_1_7). By command line I change the JAVA_HOME value like this:
set JAVA_HOME=path_to_my_jdk_1_8
Now if I type
C:\Users\Francesco>java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
but when I type
C:\Users\Francesco>javac -version
javac 1.7.0_45
Why javac is still 1.7?
You need to run set PATH=%JAVA_HOME%\bin; again after setting the JAVA_HOME variable to 1.8 JAVA_HOME.

Change Java version terminal uses

my first post on this forum, so please give me a break. Recently I installed java 7 for my computer, but I had downloaded java 6 before. Currently the Java control panel and the java website tells me that I have Java 7. However, when I go into the terminal and type: java -version, it comes up with:
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)
I am aware that terminal accesses java from the path '/usr/bin/java', and the control panel accesses java from the path '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java', so how can I change the terminal path to java?
Try using $ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) - it's the canonical way to switch Java versions.
Here's what it looks like on my machine:
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
$ 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)
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

Categories

Resources