Tuesday, September 10, 2013

Installing Obsolete Java JDK versions on Fedora Linux

As a Java developer, one is frequently forced to use obsolete, or even deprecated, Java versions. So I came to the necessity to install Java 6 on Fedota 19. The problem: In the Fedora 19 repositories, there's only Java 7 and 8. Convince yourself:

$ sudo yum list | grep openjdk
java-1.6.0-openjdk.x86_64              1:1.6.0.0-59.1.10.3.fc16         installed
java-1.6.0-openjdk-devel.x86_64        1:1.6.0.0-59.1.10.3.fc16         installed
java-1.6.0-openjdk-javadoc.x86_64      1:1.6.0.0-59.1.10.3.fc16         installed
java-1.7.0-openjdk.x86_64              1:1.7.0.60-2.4.2.0.fc19          @updates
java-1.7.0-openjdk-demo.x86_64         1:1.7.0.60-2.4.2.0.fc19          @updates
java-1.7.0-openjdk-devel.x86_64        1:1.7.0.60-2.4.2.0.fc19          @updates
java-1.7.0-openjdk-javadoc.noarch      1:1.7.0.60-2.4.2.0.fc19          @updates
java-1.7.0-openjdk-src.x86_64          1:1.7.0.60-2.4.2.0.fc19          @updates
java-1.7.0-openjdk-accessibility.x86_64
java-1.8.0-openjdk.i686                1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk.x86_64              1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk-demo.x86_64         1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk-devel.i686          1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk-devel.x86_64        1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk-javadoc.noarch      1:1.8.0.0-0.9.b89.fc19           updates 
java-1.8.0-openjdk-src.x86_64          1:1.8.0.0-0.9.b89.fc19           updates 
The same goes for Fedora 18 and 17, btw. (I'll skip the output here. Note, that processing these commands will take some time, as yum will download the complete repository metadata for the respective version.
$ sudo yum --releasever=17 list | grep openjdk
$ sudo yum --releasever=18 list | grep openjdk
However, Java 6 is available for Fedora 16!
$ export http_proxy=MY_PROXY_URL, for example http://my.proxy.server:8080
$ wget wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/x86_64/os/Packages/java-1.6.0-openjdk-1.6.0.0-59.1.10.3.fc16.x86_64.rpm
$ wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/x86_64/os/Packages/java-1.6.0-openjdk-devel-1.6.0.0-59.1.10.3.fc16.x86_64.rpm
$ wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/x86_64/os/Packages/java-1.6.0-openjdk-javadoc-1.6.0.0-59.1.10.3.fc16.x86_64.rpm
Now, my first (and preferred) attempt to install these would be
$ sudo yum localinstall --obsoletes java-1.6.0-openjdk*
which fails, due to the following error message:
  error: Failed dependencies:
  java-1.6.0-openjdk is obsoleted by (installed) java-1.7.0-openjdk-1:1.7.0.60-2.4.2.0.fc19.x86_64
  java-1.6.0-openjdk-devel is obsoleted by (installed) java-1.7.0-openjdk-1:1.7.0.60-2.4.2.0.fc19.x86_64
  java-1.6.0-openjdk-javadoc is obsoleted by (installed) java-1.7.0-openjdk-1:1.7.0.60-2.4.2.0.fc19.x86_64
(Please contact me, if you have an idea on how to get rid of these!) Fortunately, there's another possibility, which does the job quite neatly:
$ sudo rpm --nodeps -i java-1.6.0-openjdk*
If you're an Eclipse user, the JDK can now be found in /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/

Friday, May 3, 2013

Slow Startup of Cygwin Bash

When on Windows, I never use another terminal/shell than MinTTY/CygWin Bash. So I was heavily harmed by a problem that started quite some time ago: Suddenly, when I opened MinTTY, it took 10 seconds or so, before the bash prompt became visible. Today, I finally discovered the culprit by reading another post. As you posssibly know, there is a directory /etc/profile.d containing scripts that are executed when a login shell is starting. Now, one of these scripts, called bash_completion.sh is extremely slow. You can try for yourself:
$ time . /etc/profile.d/bash_completion.sh

real    0m8.908s
user    0m1.402s
sys     0m7.310s

In other words, solving the issue for me was as simple as renaming this script:
$ mv /etc/profile.d/bash_completion.sh /etc/profile.d/bash_completion.sh.disabled
Voila! My MinTTY opens immediately again. Update: The above time command is only slow when the script is being executed for the first time. In other words, if your bash was starting slow due to executing it, then you might see a result like this:
$ time . /etc/profile.d/bash_completion.sh

real    0m0.000s
user    0m0.000s
sys     0m0.000s