How to install Java using apt-get

Java is a programming language that's specifically designed to be as platform independent as possible. Developers can write their applications once without the need to recompile a separate version of the application for each platform. The Advanced Packaging Tool is the most common method of installing Java on Debian Linux distributions such as Ubuntu. Apt simplifies software management on these systems by automating much of this process, including the download, configuration and installation of software packages. This example shows how to select a Java Development Kit (JDK) 7 installation package, install it with apt and verify that Java has been properly installed.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
RELATED PRODUCTS Ubuntu-based VPS or dedicated servers

Here is a quick tutorial on how to how to install Java using apt-get.

Select the Java package to install

Open a terminal window and login as root. Execute the following command to list the available OpenJDK packages that can install Java:

# apt-cache search openjdk

Select openjdk-7-jdk for this example, which is the OpenJDK 7 Development Kit.

Install OpenJDK

Enter this command to update the list of available packages from your remote repositories:

# apt-get update

Enter the following command to install the software package you have selected.

# apt-get install openjdk-7-jdk

Press 'y' when prompted to authorize the required storage space for the installation.

Verify that Java has been installed

This command provides the version of Java that was installed:

# java -version

The following screenshot shows that java 1.7.0_65 was installed in this example:

Ήταν χρήσιμο αυτό το άρθρο;
Σας ευχαριστούμε για τα σχόλια. Για να μιλήσετε με έναν εκπρόσωπο της εξυπηρέτησης πελατών, χρησιμοποιήστε τον αριθμό τηλεφώνου υποστήριξης ή την παραπάνω επιλογή συνομιλίας.
Χαιρόμαστε που βοηθήσαμε! Υπάρχει κάτι άλλο που μπορούμε να κάνουμε για εσάς;
Λυπούμαστε. Πείτε μας τι σας μπέρδεψε ή γιατί η λύση δεν ήταν αποτελεσματική για το πρόβλημά σας.