javac is not Available for sun-jre-bin-1.6 on x86_64

Problem

When trying to compile some Java code on my x86_64 (amd64) 64-bit Gentoo machine I was greeted with the following error message:

* javac is not available for sun-jre-bin-1.6 on x86_64
* IMPORTANT: some Java tools are not available on some VMs on some architectures

Solution

This can be fixed by installing and/or setting the JDK to system as below:

To see what VM’s were available: eselect java-vm list

Available Java Virtual Machines:
[1]   sun-jre-bin-1.6  system-vm

sun-jre does not contain tools such as javac and jar, so we need to install sun-jdk:

# emerge sun-jdk
# eselect java-vm list
Available Java Virtual Machines:
  [1]   sun-jdk-1.6
  [2]   sun-jre-bin-1.6  system-vm

and then selected as the system wide VM: # eselect java-vm set system 1

tags fixjavalinux