配置java环境小编觉得比php环境要简单不知道是不是小编觉得apache或nginx太麻烦了,下面来为各位介绍Debian8 (Jessie)安装配置java环境步骤,有兴趣的来看看.
系统是 Debian8,Jessie,默认java版本是:OpenJDK 1.7
1.检查当前系统的java版本
- leung@phychion:~$java-version
- javaversion"1.7.0_65"
- OpenJDKRuntimeEnvironment(IcedTea2.5.2)(7u65-2.5.2-4)
- OpenJDK64-BitServerVM(build24.65-b04,mixedmode)
2.配置安装java:
- leung@phychion:~/Downloads$tarzxfjdk-7u67-linux-x64.tar.gz
- leung@phychion:~/Downloads$sudomvjdk1.7.0_67/usr/lib/jvm/
3.编辑/etc/profile,添加环境变量:
- leung@phychion:~/Downloads$sudovi/etc/profile
- exportJAVA_HOME=/usr/lib/jvm/jdk1.7.0_67
- exportJRE_HOME=${JAVA_HOME}/jre
- exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
- exportPATH=${JAVA_HOME}/bin:$PATH--phpfensi.com
4.使用环境变量生效,不必重新登录shell:
leung@phychion:~/Downloads$ source /etc/profile
5.配置JDK1.7的java,javac工具:
- leung@phychion:~$sudoupdate-alternatives--install/usr/bin/javajava/usr/lib/jvm/jdk1.7.0_67/bin/java300
- leung@phychion:~$sudoupdate-alternatives--install/usr/bin/javacjavac/usr/lib/jvm/jdk1.7.0_67/bin/javac300
- update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/javactoprovide/usr/bin/javac(javac)inautomode
6.设置系统默认的java版本,这里选择2:
- leung@phychion:~$sudoupdate-alternatives--configjava
- Thereare2choicesforthealternativejava(providing/usr/bin/java).
- SelectionPathPriorityStatus
- ------------------------------------------------------------
- *0/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java1071automode
- 1/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java1071manualmode
- 2/usr/lib/jvm/jdk1.7.0_67/bin/java300manualmode
- Pressentertokeepthecurrentchoice[*],ortypeselectionnumber:2
- update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/javatoprovide/usr/bin/java(java)inmanualmode
- leung@phychion:~$sudoupdate-alternatives--configjavac
- Thereisonlyonealternativeinlinkgroupjavac(providing/usr/bin/javac):/usr/lib/jvm/jdk1.7.0_67/bin/javac
- Nothingtoconfigure.
7.确认设置的java版本:
- leung@phychion:~$java-version
- javaversion"1.7.0_67"
- Java(TM)SERuntimeEnvironment(build1.7.0_67-b01)
- JavaHotSpot(TM)64-BitServerVM(build24.65-b04,mixedmode)