Trợ giúp

Trợ giúp GoDaddy

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:

Bài này có hữu ích không?
Cảm ơn về phản hồi của bạn. Để nói chuyện với một đại diện của dịch vụ khách hàng, vui lòng sử dụng số điện thoại hỗ trợ hoặc tùy chọn trò chuyện ở trên.
Rất vui vì chúng tôi đã giúp được bạn! Chúng tôi có thể làm gì thêm cho bạn?
Rất tiếc về điều đó. Vui lòng cho chúng tôi biết điều gì làm cho bạn bối rối và vì sao giải pháp không khắc phục được vấn đề này.