I downloaded jdk-9.0.1_linux-x64_bin.tar.gz and jre-9.0.1_linux-x64_bin.tar.gz from link http://www.oracle.com/technetwork/java/javase/downloads/index.html. extracted them and psasted in /usr/local/java. Then edited /etc/profile to add
JAVA_HOME=/usr/local/java/jdk-9.0.1
JRE_HOME=/usr/local/java/jre-9.0.1
PATH=$PATH:$JRE_HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
the whole file looks like
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
JAVA_HOME=/usr/local/java/jdk-9.0.1
JRE_HOME=/usr/local/java/jre-9.0.1
PATH=$PATH:$JRE_HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
then typed following commands
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk-9.0.1/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk-9.0.1/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk-9.0.1/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jdk-9.0.1/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk-9.0.1/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk-9.0.1/bin/javaws
source /etc/profile
reboot
now java -version is showing
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
after that I tried to install android studio
I get the following message
./studio.sh
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARN: Unknown class loader: jdk.internal.loader.ClassLoaders$AppClassLoader
WARN: Unknown class loader: jdk.internal.loader.ClassLoaders$PlatformClassLoader
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.lang.UrlClassLoader (file:/home/user/Downloads/Android/android-studio/lib/util.jar) to field java.lang.ClassLoader.parallelLockMap
WARNING: Please consider reporting this to the maintainers of com.intellij.util.lang.UrlClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
JDK Required: 'tools.jar' seems to be not in Studio classpath.
Please ensure JAVA_HOME points to JDK rather than JRE.