JDK(Sun Java)インストール+設定
最終更新日:2020/11/08 | 公開日:2011/03/03
目次
構成
想定環境
サーバ構成
OSバージョン
CentOS 5.5 64bit
パッケージ一覧
jdk-6u24-linux-x64-rpm.bin
※上記バイナリを実行すると、下記7つのrpmファイルが展開され、インストールされる。
jdk-6u24-linux-amd64.rpm
sun-javadb-common-10.6.2-1.1.i386.rpm
sun-javadb-core-10.6.2-1.1.i386.rpm
sun-javadb-client-10.6.2-1.1.i386.rpm
sun-javadb-demo-10.6.2-1.1.i386.rpm
sun-javadb-docs-10.6.2-1.1.i386.rpm
sun-javadb-javadoc-10.6.2-1.1.i386.rpm
環境構築
インストール
# cd /tmp/ # chmod u+x jdk-6u24-linux-x64-rpm.bin # ./jdk-6u24-linux-x64-rpm.bin Unpacking... Checksumming... Extracting... UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu). inflating: jdk-6u24-linux-amd64.rpm inflating: sun-javadb-common-10.6.2-1.1.i386.rpm inflating: sun-javadb-core-10.6.2-1.1.i386.rpm inflating: sun-javadb-client-10.6.2-1.1.i386.rpm inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm 準備中... ########################################### [100%] 1:jdk ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... plugin.jar... javaws.jar... deploy.jar... Installing JavaDB 準備中... ########################################### [100%] 1:sun-javadb-common ########################################### [ 17%] 2:sun-javadb-core ########################################### [ 33%] 3:sun-javadb-client ########################################### [ 50%] 4:sun-javadb-demo ########################################### [ 67%] 5:sun-javadb-docs ########################################### [ 83%] 6:sun-javadb-javadoc ########################################### [100%] Java(TM) SE Development Kit 6 successfully installed. Product Registration is FREE and includes many benefits: * Notification of new versions, patches, and updates * Special offers on Oracle products, services and training * Access to early releases and documentation Product and system data will be collected. If your configuration supports a browser, the JDK Product Registration form will be presented. If you do not register, none of this information will be saved. You may also register your JDK later by opening the register.html file (located in the JDK installation directory) in a browser. For more information on what data Registration collects and how it is managed and used, see: http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html Press Enter to continue..... Done. # rm -f ./jdk-6u24-linux-amd64.rpm # rm -f ./sun-javadb-*
設定
# cd /etc/ # vi profile
ファイル名:/etc/profile
※ファイルの末尾に追加※ (前略) unset i unset pathmunge export JAVA_HOME=/usr/java/jdk1.6.0_24 ←この行を追加 export PATH=$PATH:$JAVA_HOME/bin ←この行を追加 export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar ←この行を追加
# source ./profile
動作テスト
# java -version java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)