<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>The BFC Computing Weblog: Sun Java for CentOS 5</title>
    <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>My God, It's Full of Source!</description>
    <item>
      <title>Sun Java for CentOS 5</title>
      <description>&lt;p&gt;Unfortunately the GNU java in &lt;a href="http://centos.org"&gt;CentOS&lt;/a&gt; 5 is too old to run modern Java code.  So, you need to install the Sun version in many cases, and the &lt;a href="http://jpackage.org"&gt;jpackage&lt;/a&gt; method is typically the best way to do that.  Two problems, though: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They don&amp;#8217;t have an RPM that represents the current Sun version&lt;/li&gt;
&lt;li&gt;Their version doesn&amp;#8217;t work well on CentOS due to CentOS RPM bugs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you don&amp;#8217;t have them already installed, you need the RPM development tools.  Something like: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;yum -y install rpm-build rpmdevtools&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;should be sufficient.  (note: I&amp;#8217;m assuming you&amp;#8217;re root.  Most of this can also be done with a local RPM build tree and sudo, but is beyond the scope of this article).&lt;/p&gt;

&lt;p&gt;As of this writing the current security release of the Java JDK is 1.6u7, which you can get &lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;here&lt;/a&gt;.  Pick 32-bit linux (the only type I tested) get the linux &lt;b&gt;non-RPM&lt;/b&gt; version, and put the downloaded &amp;#8216;.bin&amp;#8217; file in &lt;code&gt;/usr/src/redhat/SOURCES&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now, download my updated &lt;a href="http://bfccomputing.com/downloads/java/java-1.6.0-sun-centos-5.spec"&gt;spec file&lt;/a&gt; and put it in &lt;code&gt;/usr/src/redhat/SPEC&lt;/code&gt;.  If you&amp;#8217;re on a Fedora platform or CentOS fixes their version of &lt;code&gt;rpm&lt;/code&gt; you might want &lt;a href="http://bfccomputing.com/downloads/java/java-1.6.0-sun.spec"&gt;this non-CentOS spec&lt;/a&gt; instead.  This latter one builds everything just fine on CentOS but there are UnixODBC link errors due to the &lt;a href="http://mann-linuxproject.blogspot.com/2007/07/problem5.html"&gt;rpm bug&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, build Java with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd /usr/src/redhat
rpmbuild -ba SPEC/java-1.6.0-sun-centos-5.spec
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will take a while.  You should wind up with a bunch of RPM files in RPMS/i586/, like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-rw-r--r-- 1 root root 43085836 Aug 11 22:48 java-1.6.0-sun-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root    35903 Aug 11 22:48 java-1.6.0-sun-alsa-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root 10473773 Aug 11 22:48 java-1.6.0-sun-demo-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root 21709383 Aug 11 22:48 java-1.6.0-sun-devel-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root  1259794 Aug 11 22:48 java-1.6.0-sun-fonts-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root    26057 Aug 11 22:48 java-1.6.0-sun-jdbc-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root   807126 Aug 11 22:48 java-1.6.0-sun-plugin-1.6.0.7-1jpp.i586.rpm
-rw-r--r-- 1 root root 17692845 Aug 11 22:48 java-1.6.0-sun-src-1.6.0.7-1jpp.i586.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Use yum to install them like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd RPMS/i586
yum --nogpgcheck localinstall java-1.6.0-sun-*.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It should find dependencies, something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 java-1.6.0-sun-alsa     i586       1.6.0.7-1jpp     java-1.6.0-sun-alsa-1.6.0.7-1jpp.i586.rpm   79 k
 java-1.6.0-sun-demo     i586       1.6.0.7-1jpp     java-1.6.0-sun-demo-1.6.0.7-1jpp.i586.rpm   15 M
 java-1.6.0-sun-devel    i586       1.6.0.7-1jpp     java-1.6.0-sun-devel-1.6.0.7-1jpp.i586.rpm   36 M
 java-1.6.0-sun-fonts    i586       1.6.0.7-1jpp     java-1.6.0-sun-fonts-1.6.0.7-1jpp.i586.rpm  2.0 M
 java-1.6.0-sun-jdbc     i586       1.6.0.7-1jpp     java-1.6.0-sun-jdbc-1.6.0.7-1jpp.i586.rpm   69 k
 java-1.6.0-sun-plugin   i586       1.6.0.7-1jpp     java-1.6.0-sun-plugin-1.6.0.7-1jpp.i586.rpm  1.6 M
 java-1.6.0-sun-src      i586       1.6.0.7-1jpp     java-1.6.0-sun-src-1.6.0.7-1jpp.i586.rpm   18 M
Installing for dependencies:
 java-1.6.0-sun          i586       1.6.0.7-1jpp     java-1.6.0-sun-1.6.0.7-1jpp.i586.rpm   68 M
 libXp                   i386       1.0.0-8.1.el5    base               23 k
 unixODBC-devel          i386       2.2.11-7.1       base              739 k
 unixODBC                i386       2.2.11-7.1       base              832 k
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And yum should download and complete without errors.  &lt;/p&gt;

&lt;p&gt;Now, make sure that this new version of Java is set to be the default with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/usr/sbin/alternatives --config java&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and enjoy current java.  Hopefully it won&amp;#8217;t be long before Sun gets its code freed so next time you can just &amp;#8216;yum -y install sun-java&amp;#8217;. &lt;/p&gt;</description>
      <pubDate>Mon, 11 Aug 2008 23:03:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:43fdc898-7206-4b72-834e-855dc5d4e757</guid>
      <author>Bill McGonigle</author>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5</link>
      <category>Development</category>
      <category>Open Source</category>
      <category>Linux</category>
      <category>HOWTO</category>
      <trackback:ping>http://blog.bfccomputing.com/articles/trackback/4775</trackback:ping>
    </item>
    <item>
      <title>"Sun Java for CentOS 5" by Richard Sharpe</title>
      <description>&lt;p&gt;Finally got them installed with&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rpm -Uvh --nodeps java*.rpm&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don't care about  ODBC, I just want to run the Fedora/CentOS directory services admin tool.&lt;/p&gt;</description>
      <pubDate>Wed, 27 Aug 2008 13:13:44 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:366d3ec8-e841-44da-af20-28d7c84cd3a0</guid>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5#comment-30524</link>
    </item>
    <item>
      <title>"Sun Java for CentOS 5" by Richard Sharpe</title>
      <description>&lt;p&gt;OK, it doesn't matter if I build with or without the CentOS specific SPEC file. I get the same problem each time with the bogus libodbcinst.so required ... &lt;/p&gt;

&lt;p&gt;Maybe I need to remove them?&lt;/p&gt;</description>
      <pubDate>Tue, 26 Aug 2008 17:12:18 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:38ee62ce-a4dc-46e4-bd7d-e19e92e7e0cd</guid>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5#comment-30523</link>
    </item>
    <item>
      <title>"Sun Java for CentOS 5" by Richard Sharpe</title>
      <description>&lt;p&gt;OK, got this:&lt;/p&gt;

&lt;p&gt;Error: Missing Dependency: libodbcinst.so()(64bit) is needed by package java-1.6.0-sun-jdbc&lt;/p&gt;</description>
      <pubDate>Tue, 26 Aug 2008 17:02:21 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:c62f7149-424d-432f-a162-57b56da7cfb3</guid>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5#comment-30522</link>
    </item>
    <item>
      <title>"Sun Java for CentOS 5" by Richard Sharpe</title>
      <description>&lt;p&gt;Hmmm, looks like I downloaded the wrong file :-(&lt;/p&gt;</description>
      <pubDate>Tue, 26 Aug 2008 16:55:27 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a54c2c1e-6e7f-4587-9fb4-50e1364820a1</guid>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5#comment-30521</link>
    </item>
    <item>
      <title>"Sun Java for CentOS 5" by Richard Sharpe</title>
      <description>&lt;p&gt;Hmmm,&lt;/p&gt;

&lt;p&gt;I tried the above steps, but I always get the following when trying to build (btw, I think it might be SPECS not SPEC):&lt;/p&gt;

&lt;p&gt;rpmbuild -ba SPECS/java-1.6.0-sun-centos-5.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.51692&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;umask 022&lt;/li&gt;
&lt;li&gt;cd /usr/src/redhat/BUILD&lt;/li&gt;
&lt;li&gt;rm -rf /usr/src/redhat/BUILD/jdk1.6.0_07&lt;/li&gt;
&lt;li&gt;export MORE=10000&lt;/li&gt;
&lt;li&gt;MORE=10000&lt;/li&gt;
&lt;li&gt;sh /usr/src/redhat/SOURCES/jdk-6u7-linux-x64.bin
replace jdk-6u7-linux-amd64.rpm? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(assuming [N]one)
    package jdk-1.6.0_07-fcs is already installed&lt;/li&gt;
&lt;li&gt;cd /usr/src/redhat/BUILD&lt;/li&gt;
&lt;li&gt;cd jdk1.6.0_07
/var/tmp/rpm-tmp.51692: line 28: cd: jdk1.6.0_07: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.51692 (%prep)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RPM build errors:&lt;/p&gt;

    Bad exit status from /var/tmp/rpm-tmp.51692 (%prep)

&lt;p&gt;This suggests that the .bin file I have is not creating the directory jdk1.6.0_07 or something.&lt;/p&gt;

&lt;p&gt;Any ideas what is going wrong?&lt;/p&gt;

&lt;p&gt;&lt;a href="mailto:realrichardsharpe@gmail.com" rel="nofollow"&gt;realrichardsharpe@gmail.com&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 26 Aug 2008 16:20:29 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:52c0b65d-837d-4666-85e2-88a92020e4f4</guid>
      <link>http://blog.bfccomputing.com/articles/2008/08/11/sun-java-for-centos-5#comment-30520</link>
    </item>
  </channel>
</rss>
