how to install Java SDK on CentOS

java logo Lately at work I’m being occupied preparing the “golden” node of a 14 machines pool of CentOS servers to be cloned and I’ve found myself in the situation of having to install Java on this Red Hat derived Linux distribution.

Unfortunately, even if Sun has released the whole Java ambaradan with a free software licence, this has happened too late to permit to the CentOS project (but also other distribution) the inclusion of the relative packages in their 5th release. This will change when the CentOS 6 will be released.

So, to correctly install Java (either the Runtime Environment or the Software Development Kit) is needed to follow the instructions given to us by the community on the How To Install Java on CentOS 4 and CentOS 5 page published on the official wiki.

You’ll just have to be a bit cautious and pay attention to these simple points:

  • remove any java package (in it’s old free/open implementation) previously (eventually) installed from the CentOS repos;
  • remove the eventual tomcat5 and all it’s related packages;
  • follow the How to Set Up an RPM Build Environment under CentOS procedure;
  • the package java-1.6.0-sun-1.6.0.10-1jpp.nosrc.rpm cited in the how-to needs the release 10 of the JDK, and now the main page of the Sun’s official page presents you the update11 … a little diggin’ in the Sun download section it’s needed to find the desired *.bin file.

When the procedure will finish you’ll have build on your system the necessary rpm packages that will be installed with a simple yum localinstall or rpm -Uvh command.

After that a yum install tomcat5 has put up Tomcat (and other 37 packages) with no dependency problem at all.

I hope this will be useful to some 😀

4 thoughts on “how to install Java SDK on CentOS

  1. 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 am install JAVA using Command # yum install java-1.6.0-openjdk-devel

    I have set my JAVA_PATH=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64

    Also I have set my CLASSPATH=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/

    Also is there need to set PATH???
    I Don’t know what is going wrong.

    Like

  2. Hi Sandy … I see you’ve posted everywhere your issue … unfortunately I can’t help so I hope you’ll have better luck elsewhere …

    Like

  3. Hi there
    Hope someone can help me out a little bit

    JDK error while installing Red5 0.9RC1 with ANT 1.8.2, Ivy 2.2.0, on a centOS box 5.7 JAVA 1.6.2

    [ivy:resolve] [SUCCESSFUL ] jetty#jetty;6.1.9!jetty.jar (148ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jetty/jetty-util-6.1.9.jar
    [ivy:resolve] ………………………… (156kB)
    [ivy:resolve] [SUCCESSFUL ] jetty#jetty-util;6.1.9!jetty-util.jar (62ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jetty/jetty-xbean-6.1.9.jar
    [ivy:resolve] .. (5kB)
    [ivy:resolve] [SUCCESSFUL ] jetty#jetty-xbean;6.1.9!jetty-xbean.jar (137ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/slf4j-api-1.5.6.jar
    [ivy:resolve] ….. (21kB)
    [ivy:resolve] [SUCCESSFUL ] red5#slf4j-api;1.5.6!slf4j-api.jar (87ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jcl-over-slf4j-1.5.6.jar
    [ivy:resolve] …… (16kB)
    [ivy:resolve] [SUCCESSFUL ] red5#jcl-over-slf4j;1.5.6!jcl-over-slf4j.jar (58ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/log4j-over-slf4j-1.5.6.jar
    [ivy:resolve] .. (9kB)
    [ivy:resolve] [SUCCESSFUL ] red5#log4j-over-slf4j;1.5.6!log4j-over-slf4j.jar (110ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jul-to-slf4j-1.5.6.jar
    [ivy:resolve] .. (4kB)
    [ivy:resolve] [SUCCESSFUL ] red5#jul-to-slf4j;1.5.6!jul-to-slf4j.jar (113ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/logback-core-0.9.14.jar
    [ivy:resolve] ……………………………………. (225kB)
    [ivy:resolve] [SUCCESSFUL ] red5#logback-core;0.9.14!logback-core.jar (119ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/logback-classic-0.9.14.jar
    [ivy:resolve] ………………………………… (152kB)
    [ivy:resolve] [SUCCESSFUL ] red5#logback-classic;0.9.14!logback-classic.jar (200ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/tomcat-juli-slf4j-1.5.0.jar
    [ivy:resolve] .. (3kB)
    [ivy:resolve] [SUCCESSFUL ] red5#tomcat-juli-slf4j;1.5.0!tomcat-juli-slf4j.jar (54ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-beanutils-1.8.0.jar
    [ivy:resolve] ………………………………………. (225kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-beanutils;1.8.0!commons-beanutils.jar (66ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-codec-1.3.jar
    [ivy:resolve] …… (45kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-codec;1.3!commons-codec.jar (95ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-collections-3.2.1.jar
    [ivy:resolve] ……………………………………………………………………………………………………….. (561kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-collections;3.2.1!commons-collections.jar (129ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-httpclient-3.1.jar
    [ivy:resolve] ………………………………………………………. (297kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-httpclient;3.1!commons-httpclient.jar (105ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-lang-2.4.jar
    [ivy:resolve] ……………………………….. (255kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-lang;2.4!commons-lang.jar (79ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/commons/commons-pool-1.4.jar
    [ivy:resolve] …….. (85kB)
    [ivy:resolve] [SUCCESSFUL ] commons#commons-pool;1.4!commons-pool.jar (85ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/quartz-1.6.5.jar
    [ivy:resolve] ………………………………………………… (436kB)
    [ivy:resolve] [SUCCESSFUL ] red5#quartz;1.6.5!quartz.jar (153ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/javax/jta-1.1.jar
    [ivy:resolve] …. (12kB)
    [ivy:resolve] [SUCCESSFUL ] javax#jta;1.1!jta.jar (142ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/ehcache-1.6.0-rc1.jar
    [ivy:resolve] …………………………….. (203kB)
    [ivy:resolve] [SUCCESSFUL ] red5#ehcache;1.6.0-rc1!ehcache.jar (115ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/javax/activation-1.1.jar
    [ivy:resolve] ……… (61kB)
    [ivy:resolve] [SUCCESSFUL ] javax#activation;1.1!activation.jar (173ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/xercesImpl-2.9.1.jar
    [ivy:resolve] …………………………………………………………………………………………………………………………. (1200kB)
    [ivy:resolve] [SUCCESSFUL ] red5#xercesImpl;2.9.1!xercesImpl.jar (216ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/xml-apis-2.9.1.jar
    [ivy:resolve] ………………. (189kB)
    [ivy:resolve] [SUCCESSFUL ] red5#xml-apis;2.9.1!xml-apis.jar (141ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/mina/mina-core-2.0.0-M6.jar
    [ivy:resolve] ……………………………………………………………………………………. (622kB)
    [ivy:resolve] [SUCCESSFUL ] mina#mina-core;2.0.0-M6!mina-core.jar (279ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/mina/mina-integration-beans-2.0.0-M6.jar
    [ivy:resolve] .. (39kB)
    [ivy:resolve] [SUCCESSFUL ] mina#mina-integration-beans;2.0.0-M6!mina-integration-beans.jar (108ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/mina/mina-integration-jmx-2.0.0-M6.jar
    [ivy:resolve] ….. (27kB)
    [ivy:resolve] [SUCCESSFUL ] mina#mina-integration-jmx;2.0.0-M6!mina-integration-jmx.jar (107ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/asm-3.1.jar
    [ivy:resolve] ………. (42kB)
    [ivy:resolve] [SUCCESSFUL ] asm#asm;3.1!asm.jar (117ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/asm-commons-3.1.jar
    [ivy:resolve] ……. (31kB)
    [ivy:resolve] [SUCCESSFUL ] asm#asm-commons;3.1!asm-commons.jar (158ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/antlr-3.1.3.jar
    [ivy:resolve] ……………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………. (1862kB)
    [ivy:resolve] [SUCCESSFUL ] antlr#antlr;3.1.3!antlr.jar (337ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/groovy-all-1.5.7.jar
    [ivy:resolve] …………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………….. (2827kB)
    [ivy:resolve] [SUCCESSFUL ] red5#groovy-all;1.5.7!groovy-all.jar (422ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/spring/spring-context-support-2.5.6.jar
    [ivy:resolve] …………….. (94kB)
    [ivy:resolve] [SUCCESSFUL ] spring#spring-context-support;2.5.6!spring-context-support.jar (96ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jaudiotagger-1.0.8.jar
    [ivy:resolve] ……………………………………………………………………………………………………………………………………… (588kB)
    [ivy:resolve] [SUCCESSFUL ] red5#jaudiotagger;1.0.8!jaudiotagger.jar (187ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/jruby-engine-1.1.6.jar
    [ivy:resolve] .. (20kB)
    [ivy:resolve] [SUCCESSFUL ] red5#jruby-engine;1.1.6!jruby-engine.jar (116ms)
    [ivy:resolve] downloading http://red5.googlecode.com/svn/repository/bcprov-jdk16-139.jar
    [ivy:resolve] ……………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………. (1618kB)
    [ivy:resolve] [SUCCESSFUL ] red5#bcprov-jdk16;139!bcprov-jdk16.jar (237ms)
    [ivy:resolve] :: resolution report :: resolve 7531ms :: artifacts dl 8167ms
    ———————————————————————
    | | modules || artifacts |
    | conf | number| search|dwnlded|evicted|| number|dwnlded|
    ———————————————————————
    | java6 | 55 | 52 | 0 | 0 || 55 | 52 |
    ———————————————————————
    [ivy:retrieve] :: retrieving :: red5#server
    [ivy:retrieve] confs: [java6]
    [ivy:retrieve] 55 artifacts copied, 0 already retrieved (30136kB/130ms)
    [javac] /usr/local/red5/red5/build.xml:241: warning: ‘includeantruntime’ was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 548 source files to /usr/local/red5/red5/bin

    BUILD FAILED
    /usr/local/red5/red5/build.xml:220: The following error occurred while executing this line:
    /usr/local/red5/red5/build.xml:241: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin/javac compiler

    Any ideas ?
    Any help will be truly appreciated

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.