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

来自linux中国网wiki
跳到导航 跳到搜索
第43行: 第43行:
 
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
 
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
 
export JAVA_HOME JRE_HOME CLASS_PATH PATH
 
export JAVA_HOME JRE_HOME CLASS_PATH PATH
 +
</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>
 
</pre>
  

2021年7月1日 (四) 08:59的版本

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

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

国内下载地址 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

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

#像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



参考

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