Install Oracle JDK 6 update 35 in Debian Sid

Oracle asked many linux distros to remove their JDK package from their repositories, the latest version was 6.0u26, now the latest is the update 35.

In order to get in installed in Debian Sid, some easy steps must be followed.

1. Download the latest JDK from Oracle Website

2. Install debian package java-package

#aptitude install java-package

3. Let run the command to get our downloaded bin file converted into a debian package (this has to be made as a normal user, not root:

$fakeroot make-jpkg jdk-6u35-linux-x64.bin

4. Let’s install our new debian package:

#dpkg -i oracle-j2sdk1.6_1.6.0+update35_amd64.deb 

5. Now let’s update our alternatives:

#update-java-alternatives -s j2sdk1.6-oracle

6. Let’s make sure that we now have our Oracle JDK:

$java -version

This should be our output:

$java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

If we get this, then we got it right.

Hope that works for you.

Enable Java plugin in Firefox (Fedora)

To enable the Java plugin in Firefox under our Fedora 64 or 32 bits, this is what we need to do, a simple symbolic link:

64 bits:
ln -s /usr/java/latest/jre/lib/amd64/ /usr/lib64/mozilla/plugins
32 bits:
ln -s /usr/java/latest/jre/lib/i386/ /usr/lib/mozilla/plugins/

This is assuming that we have properly installed JDK first. If you see, we are pointing to the latest java instalation, this will be usefull when we update our java version.

We can check if everything worked out fine over here:

Mozilla Plugin Check

If everything is working correctly, we should see an output like this:

Mozilla Plugins Checker

Hope this works for you.

Installing JDK in Fedora 17 (Updated for the JDK 6.0 update 35 64 bits)

First thing we need to do is get the JDK installer
JDK Home @

Once we have the installer in our local repository (as root):

chmod a+x  jdk-6u35-linux-x64-rpm.bin

Let’s update our alternatives:

alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_35/jre/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_35/jre/bin/javaws 20000
alternatives --install /usr/lib64/mozilla/plugins/ /usr/java/jdk1.6.0_35/jre/lib/amd64/ 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_35/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_35/bin/jar 20000

To confirm that our installation is successfull:

java -version

Should give us an ouptput like this:

#java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

That’s it. Enjoy.

Download Varbinary in a JSF webapp

I recently had to read a varbinary (sql server 2005) and download it from my JSF application…

Here is a method to do so, it recieves the file nameĀ  (string), the content (byte[]) and file extention (string).

Add this to the import section:

import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
public static void downloadVarbinary(String fileName,
            byte[] content, String extention) {
        try {
            HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext
            ServletOutputStream servletOutputStream = httpServletResponse
                    "attachment; filename=" + fileName + "." + extention);
            httpServletResponse.setContentLength((int) content.length);
        } catch (Exception e) {