Debian8 (Jessie)安装配置java环境步骤

互联网十八般武艺 互联网十八般武艺

配置java环境小编觉得比php环境要简单不知道是不是小编觉得apache或nginx太麻烦了,下面来为各位介绍Debian8 (Jessie)安装配置java环境步骤,有兴趣的来看看.

系统是 Debian8,Jessie,默认java版本是:OpenJDK 1.7

1.检查当前系统的java版本

  1. leung@phychion:~$java-version
  2. javaversion"1.7.0_65"
  3. OpenJDKRuntimeEnvironment(IcedTea2.5.2)(7u65-2.5.2-4)
  4. OpenJDK64-BitServerVM(build24.65-b04,mixedmode)

2.配置安装java:

  1. leung@phychion:~/Downloads$tarzxfjdk-7u67-linux-x64.tar.gz
  2. leung@phychion:~/Downloads$sudomvjdk1.7.0_67/usr/lib/jvm/

3.编辑/etc/profile,添加环境变量:

  1. leung@phychion:~/Downloads$sudovi/etc/profile
  2. exportJAVA_HOME=/usr/lib/jvm/jdk1.7.0_67
  3. exportJRE_HOME=${JAVA_HOME}/jre
  4. exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
  5. exportPATH=${JAVA_HOME}/bin:$PATH--phpfensi.com

4.使用环境变量生效,不必重新登录shell:

leung@phychion:~/Downloads$ source /etc/profile

5.配置JDK1.7的java,javac工具:

  1. leung@phychion:~$sudoupdate-alternatives--install/usr/bin/javajava/usr/lib/jvm/jdk1.7.0_67/bin/java300
  2. leung@phychion:~$sudoupdate-alternatives--install/usr/bin/javacjavac/usr/lib/jvm/jdk1.7.0_67/bin/javac300
  3. update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/javactoprovide/usr/bin/javac(javac)inautomode

6.设置系统默认的java版本,这里选择2:

  1. leung@phychion:~$sudoupdate-alternatives--configjava
  2. Thereare2choicesforthealternativejava(providing/usr/bin/java).
  3. SelectionPathPriorityStatus
  4. ------------------------------------------------------------
  5. *0/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java1071automode
  6. 1/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java1071manualmode
  7. 2/usr/lib/jvm/jdk1.7.0_67/bin/java300manualmode
  8. Pressentertokeepthecurrentchoice[*],ortypeselectionnumber:2
  9. update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/javatoprovide/usr/bin/java(java)inmanualmode
  10. leung@phychion:~$sudoupdate-alternatives--configjavac
  11. Thereisonlyonealternativeinlinkgroupjavac(providing/usr/bin/javac):/usr/lib/jvm/jdk1.7.0_67/bin/javac
  12. Nothingtoconfigure.

7.确认设置的java版本:

  1. leung@phychion:~$java-version
  2. javaversion"1.7.0_67"
  3. Java(TM)SERuntimeEnvironment(build1.7.0_67-b01)
  4. JavaHotSpot(TM)64-BitServerVM(build24.65-b04,mixedmode)

相关广告
  • Debian8 (Jessie)安装配置java环境步骤 Debian8 (Jessie)安装配置java环境步骤 Debian8 (Jessie)安装配置java环境步骤
相关阅读

Debian8 (Jessie)安装配置java环境步骤

2019/10/10 17:46:41 | 谷歌SEO算法 | 自媒体