服务器配置java

  1. 先去链接下载jdk or jre(服务器上这个就好)

  2. 然后解压 tar 下载的文件,放到/usr/local/java/jdk_xxx下面

    • -v: 可视化显示进度。 Enables verbose mode, showing the progress of the command
    • -x: 解压。Extract
    • -z: 使用gzip。 Uses gzip, omit this if you just have a .tar
    • -f: 指定文件。 specifies file input, rather than STDIN
    • -C: 指定解压目录
  3. 编辑~/.bash_profile

    • .bash_profile 给bash用的用户级别的。
    • .profile Bourne 用的用户级别的。
    • /etc/profile 系统级别的。有初始化的作用。
  4. 内容

    export JAVA_HOME=/usr/local/java/jdk1.8.0_202
    export PATH=$JAVA_HOME/bin:$PATH
    
  5. source ~/.bash_profile使编辑生效。

  6. 完成

posted @ 2019-04-12 11:47  Sheldon_Lou  阅读(756)  评论(0编辑  收藏  举报