Install Sun Java on CentOS

Download Java JDK or JRE from

http://www.oracle.com/technetwork/java/javase/index-137561.html

JRE is only for running Java Programs. JDK can compile Java Source code and run it. So if you plan to make Java Program, download JDK.

Download Link for 32 Bit JDK on 19 May 2011 is

http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-i586-rpm.bin

So download it with wget

wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-i586-rpm.bin

If file get saved as different name, rename it to jdk-6u25-linux-i586-rpm.bin

Now execute it with sh ./jdk-6u25-linux-i586-rpm.bin

[root@sam ~]# sh ./jdk-6u25-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u25-linux-i586.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@sam ~]#

To check where java installed, run

[root@sam ~]# which java
/usr/bin/java
[root@sam ~]#

To check Java Version

[root@sam ~]# java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)
[root@sam ~]#
This entry was posted in CentOS and tagged , , , , , . Bookmark the permalink.
  • Sandy

    My VPS Configuration
    OS: centos-5-x86_64
    VPS Platform: OpenVZ
    HDD : 50 GB
    Ram : 1 GB

    I am trying to install 1 software on my VPS. But java is giving me some problem

    [property] java.io.IOException: Cannot run program “/bin/env”: java.io.IOException: error=12, Cannot allocate memory

    So then I am tried to allocate heap memory to JVM by using command
    # java -Xms128m -Xmx128m DoRunTime

    It will give such type of error

    Exception in thread “DoRunTime” java.lang.NoClassDefFoundError: DoRunTime
    Caused by: java.lang.ClassNotFoundException: DoRunTime

    I have set my path as follows,
    JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64

    PATH=$PATH:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin

    I am also tried simple program of JAVA & Its working properly.

    I think the problem is in JVM heap memory.

    Is there any need of creating partition???

    # free -m
    total used free shared buffers cached
    Mem: 1024 23 1000 0 0 0
    -/+ buffers/cache: 23 1000
    Swap: 0 0 0

    What should i do??
    plz reply