2

I can't install jruby on ubuntu 11.10 using rvm.

jatin@silverSpoon:~$ rvm install jruby
jruby-1.6.4 - #fetching 
jruby-1.6.4 - #extracting jruby-bin-1.6.4 to /home/jatin/.rvm/src/jruby-1.6.4
ERROR: Error running 'tar xzf "/home/jatin/.rvm/archives/jruby-bin-1.6.4.tar.gz" -C /home/jatin/.rvm/tmp/rvm_src_4913 --no-same-owner', please read /home/jatin/.rvm/log/jruby-1.6.4/extract.log
ERROR: There has been an error while trying to extract the source.  
Halting the installation.
ERROR: There has been an error while trying to fetch the source.  
Halting the installation.

Other useful information:

jatin@silverSpoon:~$ which ant
/usr/bin/ant

The contents of the log file generated are:

jatin@silverSpoon:~$ cat ~/.rvm/log/jruby-1.6.4/extract.log
[2012-02-22 00:47:37] tar xzf "/home/jatin/.rvm/archives/jruby-bin-1.6.4.tar.gz" -C /home/jatin/.rvm/tmp/rvm_src_4913 --no-same-owner

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Java installed on my machine are:

jatin@silverSpoon:~$ update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk/jre/bin/java        1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java        1061      manual mode
  2            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode
* 3            /usr/lib/jvm/jdk1.7.0/jre/bin/java              3         manual mode

Press enter to keep the current choice[*], or type selection number: 

What is wrong here?

EDIT:
On trying the answer, I get this

jatin@silverSpoon:~/android/eclipse$ rvm remove jruby
it seems that /home/jatin/.rvm/src/jruby-1.6.4 is already non existent.
it seems that /home/jatin/.rvm/rubies/jruby-1.6.4 is already non existent.
Removing jruby-1.6.4 aliases...
Removing jruby-1.6.4 wrappers...
Removing jruby-1.6.4 environments...
Removing jruby-1.6.4 binaries...

and on rvm install jruby, I get the same error.

P.S.
I am able to install jruby-head without any errors, but not any other jruby version.

EDIT 2:
I finally got it working, by installing the necessary dependencies for jruby.
See my answer below.

Jatin Ganhotra
  • 6,825
  • 6
  • 48
  • 71

2 Answers2

4

gzip: stdin: not in gzip format seems that the file downloaded is invalid.

I suggest that you remove and reinstall it:

rvm remove jruby
rvm cleanup all
rvm install jruby

rvm cleanup all means clean everything downloaded and cached.

One thing I don't understand: when I try rvm install jruby, jruby-1.6.6 got installed, but it's jruby-1.6.4 in your case.
maybe it is because you don't have the newest version of rvm. Update rvm and try again.

rvm requirements to see if you forget to install something. jruby 1.6 requires open-jre-6, not sun-jdk. hope this helps.

final edit: rvm notes, rvm requirements and see if you have missed something. I have no more ideas if you still can't install jruby(you could try reinstalling rvm though).

Tyler Liu
  • 19,552
  • 11
  • 100
  • 84
  • Yes. I double-checked on the RVM website. But, I am still getting the same error. The strange part is I can install jruby-head, but not any other version. – Jatin Ganhotra Feb 21 '12 at 10:25
  • Did the RVM upgrade too. RVM is now 1.10.2(latest stable) and now jruby it is fetching is 1.6.5.1, but still I'm getting the same error. Now, this is really driving me crazy. – Jatin Ganhotra Feb 21 '12 at 10:46
  • I also did `rvm cleanup all` before I tried `rvm install jruby`. BTW, thanks for replying back and helping me out here. – Jatin Ganhotra Feb 21 '12 at 10:47
  • it should be jruby 1.6.6 if rvm installed correctly. how did you install rvm? try `bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)` Have you `usermod -a -G rvm [your_linux_user]`? – Tyler Liu Feb 21 '12 at 13:05
  • I didn't reinstall RVM. I did `rvm get latest`. And I didn't do anything like you have said in the last line. Can you shed some light on the same, as to why would we have a rvm group? – Jatin Ganhotra Feb 21 '12 at 13:35
  • if you have the newest version of rvm installed and issue command `rvm notes`, you would be told to add user to the rvm group. – Tyler Liu Feb 21 '12 at 13:54
3

I finally got it working, by installing the necessary dependencies for jruby.
On running rvm requirements, it shows the requirements for jruby and jruby-head.

# For JRuby, install the following:
  jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
  jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk

I was missing curl, and I was using sun-java and not openjdk.
On setting the appropriate java and installing curl, I could install jruby without any hassle.

This also shows why I could install jruby-head but not jruby. Thanks @Tyler Long for all the help.

Jatin Ganhotra
  • 6,825
  • 6
  • 48
  • 71