“Linux上安装jdk”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
 
(未显示同一用户的12个中间版本)
第1行: 第1行:
  
 
=针对不同发行版本下载相对应包=
 
=针对不同发行版本下载相对应包=
 +
<pre>
 +
evan@myxps:~/data/devops/jdk$ sha1sum  jdk-8u212-linux-x64.rpm
 +
ca6872ac2f203637322ba2872cbfb3c5889d6c8d  jdk-8u212-linux-x64.rpm
 +
evan@myxps:~/data/devops/jdk$ cat jdk-8u212-linux-x64.rpm.sha1
 +
ca6872ac2f203637322ba2872cbfb3c5889d6c8d
 +
 
  rpm -ivh jdk-8u121-linux-x64.rpm   
 
  rpm -ivh jdk-8u121-linux-x64.rpm   
 +
</pre>
 +
 +
官方可直接下载了
 +
https://www.oracle.com/java/technologies/downloads/#java21
  
 
国内下载地址  
 
国内下载地址  
 
https://repo.huaweicloud.com/java/jdk
 
https://repo.huaweicloud.com/java/jdk
 +
 +
https://github.com/frekele/oracle-java/releases
  
  
第11行: 第23行:
 
=下载通用二进制包解压安装 =
 
=下载通用二进制包解压安装 =
 
<pre>
 
<pre>
tar zxvf jdk-8u65-linux-x64.tar.gz
+
 
$mv jdk1.8.0_65 jdk
+
#sep 2024
echo 'JAVA_HOME=/data/jdk/
+
export JAVA_HOME=/home/evan/data/apps/jdk
 +
export JRE_HOME=${JAVA_HOME}/jre
 +
export CLASSPATH=.:$JAVA_HOME/lib:${JRE_HOME}/lib
 +
export PATH=$PATH:$JAVA_HOME/bin:$PATH
 +
 
 +
 
 +
 
 +
 
 +
#像debian 10上没有直接的 jdk8 deb包 那就这样吧
 +
https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz
 +
tar xvf  jdk-8u201-linux-x64.tar.gz
 +
mkdir -p /data/apps
 +
mv jdk1.8.0_201 /data/apps/jdk
 +
echo 'JAVA_HOME=/data/apps/jdk/
 
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
 
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
 
PATH=$PATH:$JAVA_HOME/bin
 
PATH=$PATH:$JAVA_HOME/bin
 
export JAVA_HOME PATH' >>/etc/profile
 
export JAVA_HOME PATH' >>/etc/profile
  
 +
source /etc/profile
 +
 +
# 如果是rpm包
 
#set java environment 建议用这个
 
#set java environment 建议用这个
 
JAVA_HOME=/usr/java/jdk1.7.0_79
 
JAVA_HOME=/usr/java/jdk1.7.0_79
第37行: 第65行:
 
</pre>
 
</pre>
  
 +
==openjdk configure on kali ==
 +
<pre>
 +
 +
How to set JAVA_HOME in Linux for all users
 +
http://stackoverflow.com/questions/24641536/ddg#24641640
 +
 +
    find /usr/lib/jvm/java-1.x.x-openjdk
 +
 +
    vim /etc/profile
 +
 +
    Prepend sudo if logged in as not-privileged user, ie. sudo vim
 +
    Press 'i' to get in insert mode
 +
 +
    add:
 +
 +
    export JAVA_HOME="path that you found"
 +
 +
    export PATH=$JAVA_HOME/bin:$PATH
 +
 +
    logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell
 +
 +
 +
 +
 +
evan@myxps:~$ java --version
 +
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
 +
openjdk 11.0.8 2020-07-14
 +
OpenJDK Runtime Environment (build 11.0.8+10-post-Debian-1)
 +
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Debian-1, mixed mode, sharing)
 +
evan@myxps:~$ ls /usr/lib/jvm/java-1.
 +
java-1.11.0-openjdk-amd64/ java-1.8.0-openjdk-amd64/ 
 +
evan@myxps:~$ ls /usr/lib/jvm/java-1.
 +
java-1.11.0-openjdk-amd64/ java-1.8.0-openjdk-amd64/ 
 +
evan@myxps:~$ ls /usr/lib/jvm/java-1.8.0-openjdk-amd64
 +
 +
 +
 +
</pre>
 +
 +
=debian 移除java=
 +
<pre>
 +
jave version
 +
which java
 +
 +
dpkg --list| grep -i java
 +
 +
apt remove  --purge <package-name>
 +
 +
sudo rm -rf <install directory>
 +
</pre>
 +
https://blog.51cto.com/u_16175435/9074649
 
=参考=
 
=参考=
 +
https://docs.oracle.com/en/java/javase/21/install/overview-jdk-installation.html#GUID-8677A77F-231A-40F7-98B9-1FD0B48C346A__INSTALLINGTHEJDKANDJREONLINUX-E04E90B9
  
 
[http://blog.51cto.com/vvxyz/1642258 LInux安装jdk的三种方法]
 
[http://blog.51cto.com/vvxyz/1642258 LInux安装jdk的三种方法]

2024年9月30日 (一) 09:17的最新版本

针对不同发行版本下载相对应包

evan@myxps:~/data/devops/jdk$ sha1sum  jdk-8u212-linux-x64.rpm
ca6872ac2f203637322ba2872cbfb3c5889d6c8d  jdk-8u212-linux-x64.rpm
evan@myxps:~/data/devops/jdk$ cat jdk-8u212-linux-x64.rpm.sha1 
ca6872ac2f203637322ba2872cbfb3c5889d6c8d

 rpm -ivh jdk-8u121-linux-x64.rpm   

官方可直接下载了 https://www.oracle.com/java/technologies/downloads/#java21

国内下载地址 https://repo.huaweicloud.com/java/jdk

https://github.com/frekele/oracle-java/releases


最近Oracle发布了最新的Java SE 8u211 / Java SE 8u212,但是下载方式也改变了,原先点击Accept License Agreement同意协议即可下载,现在则多加了一步强制登录,看了下创建用户需要的信息还挺多,瞬间就没兴趣继续了;好在这个世界还是温暖的,已经有人将这些搬运到GitHub。详见:https://github.com/frekele/oracle-java/releases

下载通用二进制包解压安装


#sep 2024 
export JAVA_HOME=/home/evan/data/apps/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:$JAVA_HOME/lib:${JRE_HOME}/lib
export PATH=$PATH:$JAVA_HOME/bin:$PATH




#像debian 10上没有直接的 jdk8 deb包 那就这样吧
https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz
tar xvf  jdk-8u201-linux-x64.tar.gz
mkdir -p /data/apps
mv jdk1.8.0_201 /data/apps/jdk
echo 'JAVA_HOME=/data/apps/jdk/
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH' >>/etc/profile

source /etc/profile

# 如果是rpm包
#set java environment 建议用这个
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

configure

#set java environment 如果是rpm安装
JAVA_HOME=/usr/java/jdk1.8.0_121
JRE_HOME=/usr/java/jdk1.8.0_121/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

openjdk configure on kali


How to set JAVA_HOME in Linux for all users
http://stackoverflow.com/questions/24641536/ddg#24641640

    find /usr/lib/jvm/java-1.x.x-openjdk

    vim /etc/profile

    Prepend sudo if logged in as not-privileged user, ie. sudo vim
    Press 'i' to get in insert mode

    add:

    export JAVA_HOME="path that you found"

    export PATH=$JAVA_HOME/bin:$PATH

    logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell




evan@myxps:~$ java --version
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Debian-1, mixed mode, sharing)
evan@myxps:~$ ls /usr/lib/jvm/java-1.
java-1.11.0-openjdk-amd64/ java-1.8.0-openjdk-amd64/  
evan@myxps:~$ ls /usr/lib/jvm/java-1.
java-1.11.0-openjdk-amd64/ java-1.8.0-openjdk-amd64/  
evan@myxps:~$ ls /usr/lib/jvm/java-1.8.0-openjdk-amd64



debian 移除java

jave version 
which java 

dpkg --list| grep -i java 

apt remove  --purge <package-name>

sudo rm -rf <install directory>

https://blog.51cto.com/u_16175435/9074649

参考

https://docs.oracle.com/en/java/javase/21/install/overview-jdk-installation.html#GUID-8677A77F-231A-40F7-98B9-1FD0B48C346A__INSTALLINGTHEJDKANDJREONLINUX-E04E90B9

LInux安装jdk的三种方法

CentOS7卸载OpenJDK安装Oracle JDK

在linux服务器上安装jdk

Linux下安装JDK-(rpm版)

官网下载

使用rpm方式安装的jdk的目录位置

https://docs.oracle.com/cd/E19509-01/820-5483/inst_jdk_javahome_t/

http://wiki.jikexueyuan.com/project/linux-in-eye-of-java/JDK-Install.html

https://my.oschina.net/u/2300159/blog/504775