The Problem
I installed a new version of the Java Runtime Environment but the “java -version” command does not show the new version.
![Version Version](/uploads/1/2/5/8/125869300/459971161.png)
The Solution
Java SE 8 Archive Downloads (JDK 8u202 and earlier) Go to the Oracle Java Archive page. The JDK is a development environment for building applications using the Java programming language. The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java TM platform. This is a one, and possibly two to three step process depending on whether an older version of Java is installed as well. In the event you do.
This problem could happen due to multiple installs of java on the system. If multiple versions of openjdk packages are installed on the system, alternatives command maybe be used to set the default version of java. From the man pages of “alternatives” command:
To set a default version of java when you have multuiple java versions installed, use the below command.
How to install new java path to the alternatives java group?
You can also manually install a new Java path to the alternatives java group. This can be done using the update-alternatives command. The syntax to do it is as follows.
You can then set the newly added java path as system default using the “update-alternatives” command.
or
1. For example, in case of jre-1.7.0-openjdk.x86_64, below command can be used to install it and set as the default java version to be used.
Here,
99999 – is the priority (It should be the highest for the java version to be the default one.)
99999 – is the priority (It should be the highest for the java version to be the default one.)
2. Using alternatives, check if changes have taken effect and finally confirm the java version on system.
3. You can also use the “java -version” command to check the current version of java.
-->This article illustrates how to update the Java Development Kit (JDK) version on Windows and Mac.
Overview
Xamarin.Android uses the Java Development Kit (JDK) to integrate withthe Android SDK for building Android apps and running the Androiddesigner. The latest versions of the Android SDK (API 24 and higher)require JDK 8 (1.8). Alternately, you can install theMicrosoft Mobile OpenJDK Preview.The Microsoft Mobile OpenJDK will eventually replace JDK 8 for Xamarin.Androiddevelopment.
To update to the Microsoft Mobile OpenJDK, seeMicrosoft Mobile OpenJDK Preview.To update to JDK 8, follow these steps:
- Download JDK 8 (1.8) from the Oracle website:
- Pick the 64-bit version to allow rendering ofcustom controlsin the Xamarin Android designer:
- Run the .exe and install the Development Tools:
- Open Visual Studio and update the Java Development Kit Locationto point to the new JDK under Tools > Options > Xamarin > AndroidSettings > Java Development Kit Location:
Be sure to restart Visual Studio after updating the location.
- Download JDK 8 (1.8) from the Oracle website:
- Open the .dmg file and run the .pkg installer:
Mac OS will automatically set the new JDK version as the default byupdating /System/Library/Frameworks/JavaVM.framework/Versions/Current.You can then double-check that the Java SDK (JDK) location is set tothe expected default of /usr under Visual Studio for Mac > Preferences >Projects > SDK Locations > Android > Locations > Java SDK (JDK) Location: