Instead of installing JDK from synaptic package manager, you can manually download JDK 6 Update 17 from http://java.sun.com/javase/downloads/index.jsp. After downloading "jdk-6u17-linux-i586.bin", make it executable by changing its mode and run to install by issuing following commands.
$ chmod 777 jdk-6u17-linux-i586.bin
After that point edit your /etc/profile file to add lines below:
$ sudo gedit /etc/profile
Save /etc/profile and logout. To test your JAVA_HOME location and installed java version type from the console:
$ java -version
$ echo $JAVA_HOME