Debian GNU/Linux lenny にて、

JDK5(sun-java5-jdk) + Tomcat 5.5 の構成を、
JDK6(sun-java6-jdk) + Tomcat 5.5 の構成に変更する手順。

sun-java6-jdk をインストール


# aptitude install sun-java6-bin sun-java6-fonts sun-java6-jdk sun-java6-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  gsfonts-x11{a} libnss-mdns{a} sun-java6-bin sun-java6-fonts sun-java6-jdk
  sun-java6-jre{a} sun-java6-source
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 73.1MB of archives. After unpacking 180MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://cdn.debian.or.jp lenny/non-free sun-java6-jre 6-20-0lenny1 [6532kB]
Get:2 http://cdn.debian.or.jp lenny/non-free sun-java6-bin 6-20-0lenny1 [27.7MB]
Get:3 http://cdn.debian.or.jp lenny/non-free sun-java6-jdk 6-20-0lenny1 [20.9MB]
Get:4 http://cdn.debian.or.jp lenny/main gsfonts-x11 0.21 [10.4kB]
Get:5 http://cdn.debian.or.jp lenny/main libnss-mdns 0.10-3 [26.1kB]
Get:6 http://cdn.debian.or.jp lenny/non-free sun-java6-fonts 6-20-0lenny1 [1858B]
Get:7 http://cdn.debian.or.jp lenny/non-free sun-java6-source 6-20-0lenny1 [17.9MB]
Fetched 73.1MB in 26s (2750kB/s)
Preconfiguring packages ...
Selecting previously deselected package sun-java6-jre.
(Reading database ... 51395 files and directories currently installed.)
Unpacking sun-java6-jre (from .../sun-java6-jre_6-20-0lenny1_all.deb) ...
sun-dlj-v1-1 license has already been accepted
Selecting previously deselected package sun-java6-bin.
Unpacking sun-java6-bin (from .../sun-java6-bin_6-20-0lenny1_amd64.deb) ...
sun-dlj-v1-1 license has already been accepted
Selecting previously deselected package sun-java6-jdk.
Unpacking sun-java6-jdk (from .../sun-java6-jdk_6-20-0lenny1_amd64.deb) ...
sun-dlj-v1-1 license has already been accepted
Selecting previously deselected package gsfonts-x11.
Unpacking gsfonts-x11 (from .../gsfonts-x11_0.21_all.deb) ...
Selecting previously deselected package libnss-mdns.
Unpacking libnss-mdns (from .../libnss-mdns_0.10-3_amd64.deb) ...
Selecting previously deselected package sun-java6-fonts.
Unpacking sun-java6-fonts (from .../sun-java6-fonts_6-20-0lenny1_all.deb) ...
Selecting previously deselected package sun-java6-source.
Unpacking sun-java6-source (from .../sun-java6-source_6-20-0lenny1_all.deb) ...
Setting up gsfonts-x11 (0.21) ...
Setting up libnss-mdns (0.10-3) ...
First installation detected...
Checking NSS setup...
Setting up sun-java6-jre (6-20-0lenny1) ...
Setting up sun-java6-fonts (6-20-0lenny1) ...
Updating fontconfig cache for /usr/share/fonts/truetype/ttf-lucida
Setting up sun-java6-bin (6-20-0lenny1) ...
Setting up sun-java6-jdk (6-20-0lenny1) ...
Setting up sun-java6-source (6-20-0lenny1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

sun-java5-jdk をアンインストール


# aptitude remove sun-java5-bin sun-java5-demo sun-java5-fonts sun-java5-jdk sun-java5-jre sun-java5-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following packages will be REMOVED:
  sun-java5-bin sun-java5-demo sun-java5-jdk sun-java5-jre sun-java5-source
0 packages upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 117MB will be freed.
Writing extended state information... Done
(Reading database ... 53064 files and directories currently installed.)
Removing sun-java5-source ...
Removing sun-java5-demo ...
Removing sun-java5-bin ...
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing manually selected alternative - switching to auto mode
Removing sun-java5-jdk ...
Removing sun-java5-jre ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
 
# dpkg -l | grep sun-java
rc  sun-java5-bin                       1.5.0-22-0lenny1           Sun Java(TM) Runtime Environment (JRE) 5.0 (
rc  sun-java5-demo                      1.5.0-22-0lenny1           Sun Java(TM) Development Kit (JDK) 5.0 demos
rc  sun-java5-fonts                     1.5.0-14-1etch1            Lucida TrueType fonts (from the Sun JRE)
rc  sun-java5-jdk                       1.5.0-22-0lenny1           Sun Java(TM) Development Kit (JDK) 5.0
rc  sun-java5-jre                       1.5.0-22-0lenny1           Sun Java(TM) Runtime Environment (JRE) 5.0 (
ii  sun-java6-bin                       6-20-0lenny1               Sun Java(TM) Runtime Environment (JRE) 6 (ar
ii  sun-java6-fonts                     6-20-0lenny1               Lucida TrueType fonts (from the Sun JRE)
ii  sun-java6-jdk                       6-20-0lenny1               Sun Java(TM) Development Kit (JDK) 6
ii  sun-java6-jre                       6-20-0lenny1               Sun Java(TM) Runtime Environment (JRE) 6 (ar
ii  sun-java6-source                    6-20-0lenny1               Sun Java(TM) Development Kit (JDK) 6 source

Tomcat 5.5の設定

Tomcat を起動しようとすると、Java Home の場所がみつからないって怒られる。


# /etc/init.d/tomcat5.5 restart
Starting Tomcat servlet engine: tomcat5.5Cannot locate Java Home

/etc/default/tomcat5.5 の JAVA_HOME の値を /usr/lib/jvm/java-1.5.0-sun から /usr/lib/jvm/java-6-sun へ修正する。


# vi /etc/default/tomcat5.5

viで編集。


# cat /etc/default/tomcat5.5
(中略)
#JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
JAVA_HOME=/usr/lib/jvm/java-6-sun

Tomcat 5.5を起動


# /etc/init.d/tomcat5.5 start
Starting Tomcat servlet engine: tomcat5.5.

ということで無事に起動できた。

Ref. Debian -- lenny の sun-java6-jdk パッケージに関する詳細

tags: zlashdot Java Debian Java

Posted by NI-Lab. (@nilab)