Debian8 (Jessie)安装配置java环境步骤
发布:smiling 来源: PHP粉丝网 添加日期:2015-04-21 09:44:52 浏览: 评论:0
配置java环境小编觉得比php环境要简单不知道是不是小编觉得apache或nginx太麻烦了,下面来为各位介绍Debian8 (Jessie)安装配置java环境步骤,有兴趣的来看看.
系统是 Debian8,Jessie,默认java版本是:OpenJDK 1.7
1.检查当前系统的java版本
- leung@phychion:~$ java -version
- java version "1.7.0_65"
- OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-4)
- OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
2.配置安装java:
- leung@phychion:~/Downloads$ tar zxf jdk-7u67-linux-x64.tar.gz
- leung@phychion:~/Downloads$ sudo mv jdk1.7.0_67 /usr/lib/jvm/
3.编辑/etc/profile,添加环境变量:
- leung@phychion:~/Downloads$ sudo vi /etc/profile
- export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_67
- export JRE_HOME=${JAVA_HOME}/jre
- export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
- export PATH=${JAVA_HOME}/bin:$PATH --phpfensi.com
4.使用环境变量生效,不必重新登录shell:
leung@phychion:~/Downloads$ source /etc/profile
5.配置JDK1.7的java,javac工具:
- leung@phychion:~$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_67/bin/java 300
- leung@phychion:~$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_67/bin/javac 300
- update-alternatives: using /usr/lib/jvm/jdk1.7.0_67/bin/javac to provide /usr/bin/javac (javac) in auto mode
6.设置系统默认的java版本,这里选择2:
- leung@phychion:~$ sudo update-alternatives --config java
- There are 2 choices for the alternative java (providing /usr/bin/java).
- Selection Path Priority Status
- ------------------------------------------------------------
- * 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
- 1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
- 2 /usr/lib/jvm/jdk1.7.0_67/bin/java 300 manual mode
- Press enter to keep the current choice[*], or type selection number: 2
- update-alternatives: using /usr/lib/jvm/jdk1.7.0_67/bin/java to provide /usr/bin/java (java) in manual mode
- leung@phychion:~$ sudo update-alternatives --config javac
- There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/jdk1.7.0_67/bin/javac
- Nothing to configure.
7.确认设置的java版本:
- leung@phychion:~$ java -version
- java version "1.7.0_67"
- Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
- Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Tags: Debian8 Jessie安装配置
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)