linux安装了两个jdk怎么设置
展开全部
,jdk放到不同的dir里面,然后每个用户设置不同的环境变量,指向不同的dir
环境变量是指PATH
个人建议改在~/.bashrc, 或者~/.profile里面,可以这么写
PATH=”${PATH}xxxxx" xxxx就是你的目录
环境变量是指PATH
个人建议改在~/.bashrc, 或者~/.profile里面,可以这么写
PATH=”${PATH}xxxxx" xxxx就是你的目录
展开全部
1. 上传jdk7 和 jdk8 包
2. 解压
[root@localhost webapps]# tar -zxvf /package/jdk-7u80-linux-x64.tar.gz
3. 配置jdk变量
vi /etc/profile
export JAVA_HOME=/package/jdk1.7.0_80
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
4. java -version
5. 给jdk1.7设置序列号
[xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.7.0_80 3
6. 安装jdk1.8
[xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.8.0_124 2
7.选择jdk对应的数字--切换jdk版本
[root@localhost ~]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost ~]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /package/jdk1.8.0_121/java
2 /package/jdk1.8.0_121/bin/java
+ 3 /package/jdk1.7.0_80/bin/java
2. 解压
[root@localhost webapps]# tar -zxvf /package/jdk-7u80-linux-x64.tar.gz
3. 配置jdk变量
vi /etc/profile
export JAVA_HOME=/package/jdk1.7.0_80
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
4. java -version
5. 给jdk1.7设置序列号
[xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.7.0_80 3
6. 安装jdk1.8
[xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.8.0_124 2
7.选择jdk对应的数字--切换jdk版本
[root@localhost ~]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost ~]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /package/jdk1.8.0_121/java
2 /package/jdk1.8.0_121/bin/java
+ 3 /package/jdk1.7.0_80/bin/java
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |