惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
人人都是产品经理
人人都是产品经理
V
V2EX
爱范儿
爱范儿
PCI Perspectives
PCI Perspectives
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Hacker News
The Hacker News
小众软件
小众软件
雷峰网
雷峰网
D
Docker
NISL@THU
NISL@THU
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
U
Unit 42
有赞技术团队
有赞技术团队
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
S
Security @ Cisco Blogs
量子位
I
InfoQ
Application and Cybersecurity Blog
Application and Cybersecurity Blog
大猫的无限游戏
大猫的无限游戏
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Latest news
Latest news
The Register - Security
The Register - Security
S
Securelist
W
WeLiveSecurity
A
Arctic Wolf
Security Latest
Security Latest
AWS News Blog
AWS News Blog
L
LINUX DO - 热门话题
S
Secure Thoughts
T
Tenable Blog
Know Your Adversary
Know Your Adversary
月光博客
月光博客
M
MIT News - Artificial intelligence

博客园 - wishma

SOAR平台初探(一) Logstash和Flume-NG Syslog接收小测试 Elasticsearch 填坑记 IBM TBSM 业务关联规则配置一例 免费实用微软系统工具集推荐(转) Netcool/OMNIbus Probe脚本编写例子(1) VMware vSphere开发(2)配置VMware vSphere Web Services SDK的开发环境 VMware vSphere开发(1)安装配置VMware vSphere Web Services SDK的运行环境 数字电视业务PSI/SI学习系列(转) SMI-S存储管理协议资料 strus2格式化数字和日期(转) - wishma - 博客园 IPhone数据库操作代码例子 NSDate常用代码范例 64位windows7连接网络共享打印机的问题 IPhone 视图切换的的2种方法 我的D630,安装MAC经历 Eclipse快捷键大全(转贴) (转贴)JIRA安装和破解,随便看看吧 哥不是间谍,哥只是在找信号!(转贴有意思)
CentOS上安装Tomcat,切换JDK的方法
wishma · 2010-03-31 · via 博客园 - wishma

CentOS安装以后,默认的JDK的用的是OpenJDK,发现跑我们开发的应用验证码图像显示有问题,查了一下有个Image的接口和Sun JDK不一样,我们在Windows下开发一般都是使用Sun JDK,所以必须替换Sun JDK,一般可能要删除Open JDK,后来网上查了一下,发现了一个新的方法,使用alternatives进行java版本的转换。具体方法如下:

首先需要把新安装的jdk添加到alternatives:

[root@djn-laptop sbin]# ./alternatives --install /usr/bin/java java /usr/share/jdk1.6.0_02/bin/java 300
[root@djn-laptop sbin]# ./alternatives --install /usr/bin/javac javac /usr/share/jdk1.6.0_02/bin/javac 300

/usr/share/jdk1.6.0_02/bin/java  是我们安装的Sun JDK目录,根据具体的你们安装的目录决定。


然后使用--display选项可以查看目前系统可用的JDK:
[root@djn-laptop sbin]# ./alternatives --display java

然后可以使用--config参数来选择想用的JDK:
[root@djn-laptop sbin]# ./alternatives --config java
使用该命令后会出现JDK的列表,

* 1           /usr/lib/jvm/java-1.4.2-gcj/bin/javac
+ 2           /usr/share/jdk1.6.0_02/bin/javac
按1或2选择需要使用的jdk。切换完成以后

使用java -version查看具体版本