In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to install Java and Apt-Get in Debian8". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install Java and Apt-Get in Debian8.
The programming languages of Java and Java virtual machines or JVM are widely used and required by many kinds of software.
This tutorial provides different ways to install Java on Debian 8: you can download the default JRE or JDK or Oracle JDK. If you decide to install multiple versions of Oracle Java, you can follow the section on managing Java.
Installation preparation
An Debian 8 server.
A sudo non-root user, which you can set up by following the Debian 8 initial server setup guidelines.
Install the default JRE / JDK
The easiest option to install Java is to use a Debian-encapsulated version. Specifically, this will install OpenJDK 8, the latest recommended version.
First, update the package index.
Next, install Java. Specifically, this command installs the Java runtime environment (JRE).
one
$sudo apt-get install default-jre
When prompted, type yyes to confirm the installation.
There is also a default Java installation called JDK (Java Development Kit). If you want to compile a Java program or if it is specifically required by software that uses Java, you usually only need JDK.
JDK does include JRE, so there are no drawbacks if you install JDK instead of JRE, except for a large file size.
You can install JDK using the following command:
one
$sudo apt-get install default-jdk
You have now installed the Java runtime environment or the Java SDK.
Install Oracle JDK
If you want to install the official version of Oracle JDK distributed by Oracle, you need to perform the following steps. You will need to install the software-properties-common package before you can use the apt-get-repository command. This will help add the repository to the source list and import the associated key.
one
$sudo apt-get install software-properties-common
When prompted to confirm the installation, type y for yes.
To ensure that we get the correct line of source code on Debian, we need to run the following command that modifies the line:
one
$sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
Once we do this, we need to update:
Now we will introduce the installation process for different versions of Java. You can decide which versions to install, and you can choose to install one or more. Because it is the latest stable version, Oracle JDK 8 is the recommended version when writing.
Oracle JDK 8
Oracle JDK 8 is the latest stable version of Java at the time of this writing. You can install it using the following command:
one
$sudo apt-get install oracle-java8-installer
Again, you will be prompted to type y to confirm the installation. You will also be required to accept the Oracle binary license terms. Use the arrow keys to select Yes, and then press Enter to accept the license.
After the installation is complete, you can verify the Java version:
You will receive output similar to this:
At this point, you have installed Oracle JDK 8, but you may also need to install one or more of the following versions.
Oracle JDK 9
To install JDK 9, use the following command:
one
$sudo apt-get install oracle-java9-installer
Manage Java
There can be multiple Java installations on a server. You can configure the default version used on the command line by using update-alternatives to manage which symbolic links are used for different commands.
one
$sudo update-alternatives-config java
Set the JAVA_HOME environment variable
Many programs, such as Java servers, use the JAVA_HOME environment variable to determine where Java is installed. To set this environment variable, we first need to find out where to install Java. You can do this by executing the same command as in the previous section:
one
$sudo update-alternatives-config java
Copy the path from the preferred installation and open / etc/environment to use nano or your favorite text editor.
one
$sudo nano / etc/environment
In this file, add the following line to make sure to replace the highlighted path with the path you copied yourself. / etc/environment
one
JAVA_HOME= "/ usr/lib/jvm/java-8-oracle"
Save and exit the file, and then reload.
one
$source / etc/environment
You can now test whether the environment variable is set by executing the following command:
This will return to the path you just set.
Thank you for your reading, the above is the content of "how to install Java and Apt-Get in Debian8". After the study of this article, I believe you have a deeper understanding of how to install Java and Apt-Get in Debian8, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.