In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people have no idea about how to install Java in Linux. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Do I need JVM or JRE or JDK?
Java is roughly divided into two download categories. The Java virtual machine (JVM) is a runtime component; it is the "engine" that enables Java applications to start and run on your computer. It is included in the Java runtime environment Java Runtime Environment (JRE).
The Java development kit Java Development Kit (JDK) is a development kit: you can think of it as a garage where repairmen can sit and make adjustments, repairs, and improvements. JDK contains the Java runtime environment (JRE).
In terms of downloads, this means:
If you are the user who wants to run Java applications, all you need is JRE (including JVM).
If you are a developer who wants to program in Java, you need JDK (including the JRE library, which in turn includes JVM). # what's the difference between OpenJDK, IcedTea and OracleJDK?
When Sun Microsystems Sun Microsystems was acquired by Oracle, Java was a major part of the deal. Fortunately, Java is an open source technology, so if you are not satisfied with the way Oracle maintains the project, you can choose another approach. Oracle bundles proprietary components with Java downloads, while the OpenJDK project is completely open source.
The IcedTea project is essentially OpenJDK, but its goal is to make it easier for users to build and deploy OpenJDK when using completely free and open source tools.
(LCTT translation note: Alibaba also has an Open JDK distribution "Longjing Dragonwell" that it maintains. The following is quoted from its website: "Alibaba Dragonwell is a free, production-ready Open JDK distribution that provides long-term support, including performance enhancements and security fixes.... Alibaba Dragonwell, as the cornerstone of the Java application, supports all Java businesses in Ali economy. Alibaba Dragonwell is fully compatible with Java SE standards." )
Which Java should I install?
If you are overwhelmed by these choices, the simple answer is that the Java implementation you should install should be the easiest to install. When the application tells you that you need Java 12, but there is only Java 8 in your repository, you can install any implementation of Java 12 that can be found from reliable sources. On Linux, you can install several different versions of Java at a time without interfering with each other.
If you are a developer who needs to choose which version to use, you should consider the required components. If you choose the version of Oracle, please note that the package contains proprietary plug-ins and fonts, which may affect your distribution of your application. Developing on IcedTea or OpenJDK is the safest.
Install OpenJDK from the repository?
Now that you know what to choose, you can use the package manager to search for OpenJDK or IcedTea, and then install the desired version. Some distributions use the keyword latest to indicate the latest version, which is usually required by the application you are running. Depending on the package manager you use, you may even consider using grep to filter search results to include only the latest version. For example, on Fedora:
$sudo dnf search openjdk | grep latest | cut-F1-dazzlement 'java-latest-openjdk-demo.x86_64java-openjdk.i686java-openjdk.x86_64java-latest-openjdk-jmods.x86_64java-latest-openjdk-src.x86_64java-latest-openjdk.x86_64 [...]
You should look at previous versions of Java only if the application you are trying to run insists that you use an older version of latest.
Install Java on Fedora or similar systems:
$sudo dnf install java-latest-openjdk
If your distribution does not use latest tags, you can use other keywords, such as default. The following is the information to search for OpenJDK on Debian:
$sudo apt search openjdk | lessdefault-jdk Standard Java development kit default-jre Standard Java runtime openjdk-11-jdk OpenJDK development kit (JDK) [...]
In this case, the default-jre package is suitable for the user, while default-jdk is suitable for the developer.
For example, to install JRE on Debian:
$sudo apt install default-jre
Java is now installed.
There may be many Java-related packages in your repository. To search for OpenJDK, if you are a user, look for the latest JRE or JVM, and if you are a developer, find the latest JDK.
Install Java from the Internet
If you can't find JRE or JDK in the repository, or can't find a JRE or JDK that meets your needs, you can download the open source Java package from the Internet. You can find OpenJDK download files in tar form that need to be installed manually in openjdk.java.net, or you can download Zulu Community Edition in tar form or its installable RPM or DEB packages from Azul.
Install Java from the TAR file
If you download the TAR file from Java.net or Azul, you must install it manually. This is often called a "local" installation because you do not install Java to a "global" location. You can choose a suitable location in PATH.
If you don't know what's in PATH, check it out to find out:
$echo $PATH/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin
In this example PATH, the locations / usr/local/bin and / home/seth/bin are good choices. If you are the only user on your computer, your own home directory makes a lot of sense. If you have many users on your computer, it's best to choose a general location, such as / usr/local or / opt.
If you don't have access to system-level directories such as / usr/local that require sudo permission, you can create a local bin (meaning "binary binary" instead of "trash waste bin") or Applications folder in your own home directory:
$mkdir ~ / bin
If it is not in your PATH, add it to it:
$echo PATH=$PATH:$HOME/bin > > ~ / .bashrc$ source ~ / .bashrc
Finally, unzip the package to the directory of your choice.
$tar-extract-file openjdk*linux-x64_bin.tar.gz-directory=$HOME/bin
Java is now installed.
Install Java from RPM or DEB
If you download a RPM or DEB file from Azul.com, you can install it using the package manager.
For Fedora, CentOS, RHEL, etc., download RPM and install it using DNF:
$sudo dnf install zulu*linux.x86_64.rpm
For Debian, Ubuntu, Pop_OS, and similar distributions, download the DEB package and install it using Apt:
$sudo dpkg-I zulu*linux_amd64.deb
Java is now installed.
Install your Java version with alternatives
Some applications are developed for specific versions of Java and cannot be used with any other version. This is rare, but it does happen, and on Linux, you can use the local installation method (see the section "installing Java from a TAR file" above) or use the alternatives application to resolve this conflict.
The alternatives command looks for applications installed on the Linux system and lets you choose the version you want to use. Some distributions, such as Slackware, do not provide the alternatives command, so you must use the local installation method. On Fedora, CentOS, and similar distributions, this command is alternatives. On Debian, Ubuntu, and similar systems, this command is update-alternatives.
To get a list of available versions of applications that are currently installed on Fedora systems:
$alternatives-list
On Debian, you must specify alternative applications:
$update-alternatives-list java
On Fedora, select which version you want the system to use as the default version:
$sudo alternatives-config java
On Debian:
$sudo updates-alternatives-config java
You can change the default Java version according to the application you need to run.
Run the Java application
Java applications are usually distributed as JAR files. Depending on how you install Java, your system may be configured to run Java applications, which allows you to double-click the application icon (or select it from the application menu) to run. If you must perform a local Java installation that is not integrated with the rest of the system, you can start the Java application directly from the terminal:
$java-jar ~ / bin/example.jar & after reading the above, have you mastered how to install Java in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.