How To Install Java with Apt-Get on Ubuntu 16.04

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

  • Installing the Oracle JDK,
    First, add Oracle’s PPA, then update your package repository.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Oracle JDK 9 :

$ sudo apt-get install oracle-java9-installer

or, Oracle JDK 8:

$ sudo apt-get install oracle-java8-installer

  • Managing Java,
    There can be multiple Java installations on one server. You can configure which version is the default for use in the command line by using update-alternatives,
$ sudo update-alternatives --config java

# This can also be done for other Java commands, 
# such as the compiler (javac), the documentation generator (javadoc), 
# the JAR signing tool (jarsigner), and more. 
#$ sudo update-alternatives --config javac
#$ sudo update-alternatives --config javadoc
#$ sudo update-alternatives --config jarsigner

  • Setting the JAVA_HOME Environment Variable,
    Many programs, such as Java servers, use the JAVA_HOME environment variable to determine the Java installation location.
# To find out where Java is installed:
$ sudo update-alternatives --config java

# Copy the path from your preferred installation and then open `/etc/environment` using `nano`:

$ sudo nano /etc/environment 
# At the end of this file, add the following line,
JAVA_HOME="/usr/lib/jvm/java-9-oracle"

Save and exit the file, and reload and test it:

$ source /etc/environment

$ echo $JAVA_HOME
/usr/lib/jvm/java-9-oracle

Install Android Studio

https://developer.android.com/studio/install.html

To install Android Studio on Linux,
1. Download Android Studio
and unpack to /opt/ for shared users.

  1. To launch Android Studio,
    open a terminal, navigate to the android-studio/bin/ directory,
    and execute studio.sh.
$  cd /opt/android-studio/bin
$ ./studio.sh

Tip: To make Android Studio available in your list of applications, select Tools > Create Desktop Entry from the Android Studio menu bar.

  • Required libraries for 64-bit machines:
    If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

Leave a Reply