CentOS 5
Sponsored Link

JDK 6 - JAVA開発環境2008/08/25

 
Java SE Development Kit (JDK) を導入し、JAVAの開発実行環境を整えます。
[1]
Sun のダウンロードサイトへ行き、 「JDK 6 Update *」を選択して次へいき、セレクトボックスで「linux x64」を選んで、同意にチェックを入れます。
次ページでダウンロードできるので、それをサーバーへFTPなりSFTPなりでアップロードしておきます。
[2] インストールと設定です。
[root@www ~]#
chmod 700 jdk-6u24-linux-x64-rpm.bin

[root@www ~]#
./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
Preparing...     ########################################### [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
Preparing...     ########################################### [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.
[root@www ~]#
vi /etc/profile
# 以下、最終行にでも追記

export JAVA_HOME=/usr/java/default
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
[root@www ~]#
source /etc/profile
[3] 現在の日時を表示するテストプログラムを作って動作を確認してみます。
[root@www ~]#
vi day.java
import java.util.Calendar;
class day {
   public static void main(String[] args) {
       Calendar cal = Calendar.getInstance();
       int year = cal.get(Calendar.YEAR);
       int month = cal.get(Calendar.MONTH) + 1;
       int day = cal.get(Calendar.DATE);
       int hour = cal.get(Calendar.HOUR_OF_DAY);
       int minute = cal.get(Calendar.MINUTE);
       System.out.println(year + "/" + month + "/" + day + " " + hour + ":" + minute);
   }
}
[root@www ~]#
javac day.java
   
# コンパイル

[root@www ~]#
java day
   
# 実行

2011/4/26 20:27
関連コンテンツ