I use Sabayon Linux on my laptop and I was trying to make ruby work, unfortunately when I run ruby from the command line it gave me this error:
/usr/lib64/ruby/1.9.1/rubygems.rb:30:in `require': cannot load such file -- rubygems/defaults (LoadError) from /usr/lib64/ruby/1.9.1/rubygems.rb:30:in `<top (required)>' from <internal:gem_prelude>:1:in `require' from <internal:gem_prelude>:1:in `<compiled>'
The problem is that I am trying to run ruby 1.9.1 but the rubygems installation requires a different version
Googling a bit about it, I have found this page that taught me how to change the default Ruby version. First of all I got a list of installed executables:
$eselect ruby list Available Ruby profiles:</pre> [1] ruby19 * [2] ruby20 [3] ruby21 (with Rubygems)
Then I switch to the latest ruby,
$ sudo eselect ruby set ruby21 Password: Sorry, try again. Password: !!! SYNC setting found in make.conf. This setting is Deprecated and no longer used. Please ensure your 'sync-type' and 'sync-uri' are set correctly in /etc/portage/repos.conf/gentoo.conf Successfully switched to profile: ruby21
And it worked!!!
$ ruby -v ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
Java was a bit more complicated. Icedtea was installed by default and I had already installed my own version on the JDK from Oracle.This time eselect did not allow me to switch to my custom JDK, so I started to investigate a bit and I found out that I had to make ${HOME}/.gentoo/java-config-2/current-user-vm point to my JDK installation directory. So I did
$ mkdir ${HOME}/.gentoo $ mkdir ${HOME}/.gentoo/java-config-2 $ cd ${HOME}/.gentoo/java-config-2 $ ln -s /opt/jdk1.7.0_71/ current-user-vm $ java -version $ java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
And voilà! It worked as well