Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

java - The difference between jre / jre-1.7.0 / jre-1.7.0-openjdk / jre-openjdk /jre-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64

1. My Query & what I reseached

After I installed JDK for Linux X64 (8u181-b13), the directory of /usr/lib/jvm included the following symbolic link of jre's.

Terminal Screenshot

lrwxrwxrwx   1 root root   21 May 29  2020 jre -> /etc/alternatives/jre
lrwxrwxrwx   1 root root   27 May 12  2020 jre-1.7.0 -> /etc/alternatives/jre_1.7.0
lrwxrwxrwx   1 root root   35 May 12  2020 jre-1.7.0-openjdk -> /etc/alternatives/jre_1.7.0_openjdk
lrwxrwxrwx   1 root root   54 May 12  2020 jre-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64 -> java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64/jre
lrwxrwxrwx   1 root root   27 May 12  2020 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx   1 root root   35 May 12  2020 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx   1 root root   51 May 12  2020 jre-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64 -> java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre
lrwxrwxrwx   1 root root   29 May 12  2020 jre-openjdk -> /etc/alternatives/jre_openjdk

My query what is the difference of these versions, and which should be specifed during installation of Tomcat8.5.55 .

jre
jre-1.7.0
jre-1.7.0-openjdk
jre-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64
jre-openjdk

As far as I searched, my understanding of each sybolic link as follows.

jre

-Is a sybolic link pointing to

/etc/alternatives/jre

-It is only including JRE and does not include JDK

-The difference I found from jre-1.7.0 and jre-1.8.0 is that this jre is including "jjs" which is a javascript library which is depreciated now

jre-1.7.0

-Is a sybolic link pointing to
/etc/alternatives/jre_1.7.0

-It is only including JRE and does not include JDK

jre-1.7.0-openjdk

-Is a sybolic link pointing to
/etc/alternatives/jre_1.7.0_openjdk

-It is only including JRE and does not include JDK, only installing the JRE part from the open JDK.

jre-openjdk

-Is a sybolic link pointing to /etc/alternatives/jre_openjdk

-It is an open source implementation of JavaSE and this includes JDK.

2. Background of query & What I want to do

I am now trying to install Tomcat 8.5.55 in CentOS 7.I am asking this question because, when I create tomcat service file, there is a line which specifies the JAVA_HOME, and I couldn't figure out whether to give "jre" or "jre-1.7.0" or "jre-1.8.0" in this path.
Environment=JAVA_HOME=/usr/lib/jvm/jre

[Entire tomcat.service file]

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
 
[Service]
Type=forking
 
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=[Tomcat Home Directory]/temp/tomcat.pid
Environment=CATALINA_HOME=[Tomcat Home Directory]
Environment=CATALINA_BASE=[Tomcat Home Directory]
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
 
ExecStart=[Tomcat Home Directory]/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID
 
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
 
[Install]
WantedBy=multi-user.target

enter image description here

question from:https://stackoverflow.com/questions/65860318/the-difference-between-jre-jre-1-7-0-jre-1-7-0-openjdk-jre-openjdk-jre-1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Apache Tomcat versions page lists the Java versions that are compatible for various Tomcat versions. It says that Tomcat 8.5.x requires Java 7 or later.

However, Java 7 is end-of-life, so Java 8 is advisable.


I understand that "jre-1.7.0","jre-1.8.0" are different versions, but how about the difference between "jre" and "jre-1.7.0"?

The jre entry in that directory is a symbolic link. It ultimately resolves to the JRE version that has been selected as the default using the update-alternatives command.

You can figure it out either by following the symlinks by hand or by running update-alternatives --display java

It is probably advisable to use either the jre-1.7.0 or jre-1.8.0 symlink so that your Tomcat service uses the latest Java 7 or 8 installation installed by the package manager. (Java 8 is still getting updates ...)


As to the specific differences, it is not possible to give a definitive answer. The design of the symlinks is done by the people who implemented the OpenJDK packaging for your Linux distro. It may be different across different distros (e.g. Ubuntu vs RHEL). It could even change between versions of the same distro, though that would be "unfortunate".

However, I would assume that something that is labelled as a "jre" is only a JRE. If I want / need a JDK, I would make sure that I had installed the "jdk" package, and then use the corresponding symlink for a "jdk".

The JRE versus JDK distinction is going to become a thing of the past. From Java 9 onwards, Oracle Java and OpenJDK Java builds only come in JDK varieties. As of "Hirsute", Ubuntu distro packaging is still making the distinction between JRE and JDK packages for OpenJDK, but my guess is that at some point the Ubuntu Java packaging maintainers will decide it is not worth it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...