# Question regarding pik/ruby/jRuby

**URL:** <https://www.ruby-forum.com/t/question-regarding-pik-ruby-jruby/195852>\
**Category:** Ruby\
**Created:** [October 1, 2010, 10:13am UTC](https://www.ruby-forum.com/t/question-regarding-pik-ruby-jruby/195852 "2010-10-01T10:13:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jared\_Miller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jared\_Miller](https://www.ruby-forum.com/u/Jared_Miller)\
**Post date:** [October 1, 2010, 10:13am UTC](https://www.ruby-forum.com/t/question-regarding-pik-ruby-jruby/195852/1 "2010-10-01T10:13:03Z")

</div>

I’m very new with Ruby, and am going through Chris P.'s _Learn to  
Program_ at  
the moment. For the hell of it, though, I went ahead and installed  
pik/JRuby  
so I could play around with an article I read, on building desktop  
applications with  
JRuby[http://rubylearning.com/blog/2010/09/29/an-introduction-to-desktop-apps-with-ruby/](http://rubylearning.com/blog/2010/09/29/an-introduction-to-desktop-apps-with-ruby/)  
.

In the article on desktop apps it tells you to install JRuby through  
RVM,  
which I can’t. But, since I’m on Windows and just discovered pik, I took  
that route, thinking I’d get the same result.

Well I noticed that I had to run my scripts typing _jruby  
scriptname.rb_ whereas  
the writer could do it with _ruby scriptname.rb_, still. I asked how he  
does  
this and got the response below:

If you are using RVM it creates a â€˜rubyâ€™ symlink to jruby (see

> ~/.rvm/rubies/jruby-1.5.2/). Iâ€™m guessing in your case you installed JRuby  
> by itself which wonâ€™t have created the symlink.

I would have thought that pik would do something similar, but I guess  
not.

My other problem is that I can’t use jruby at all unless I go into  
command  
prompt and type \*pik use jruby. \*If I close command prompt, and open it  
again, I have to do it all over. Below is just showing that I have to  
_pik  
use jruby_ and once it’s set to Jruby it won’t recognize _ruby -v_.

C:\Users\Jared\>ruby -v

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

> C:\Users\Jared\>jruby -v

‘jruby’ is not recognized as an internal or external command,

operable program or batch file.

> C:\Users\Jared\>pik list

153: jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7)  
(Java

> HotSpot™ Client VM 1.6.0\_21)…

186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

> C:\Users\Jared\>pik use jruby

> C:\Users\Jared\>pik list

- 153: jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7)  
(Java

> HotSpot™ Client VM 1.6.0\_21)…

186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

> C:\Users\Jared\>jruby -v

jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7) (Java

> HotSpot™ Client VM 1.6.0\_21) [x86-java]

> C:\Users\Jared\>ruby -v

‘ruby’ is not recognized as an internal or external command,

operable program or batch file.

## Any thoughts, guys and gals?

Jared Miller

---

<div class="post-metadata">

**Author:** ![Jared\_Miller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jared\_Miller](https://www.ruby-forum.com/u/Jared_Miller)\
**Post date:** [October 22, 2010, 6:23pm UTC](https://www.ruby-forum.com/t/question-regarding-pik-ruby-jruby/195852/2 "2010-10-22T18:23:19Z")

</div>

So you don’t feel too left out, pik and RVM do similar things, but yes,  
RVM is more powerful (in large part because the Bash command line  
environment it lives in is much more powerful).

Both tools provide a method to switch from the default ruby on the  
command-line, but outside of a command-line environment, the system  
default will always be used, regardless of which tool or OS you’re  
using. As Roger suggested, you can edit the PATH variable in Windows to  
alter which ruby gets called by default; Windows will execute the first  
one it comes to in your PATH. For me, I’d just keep running ‘jruby’ on  
Windows, instead of editing the PATH constantly.

Both RVM and pik provide a method for having multiple concurrent  
versions of Ruby installed on your computer; both keep a set of gems per  
version. However, RVM also provides “gemsets”, which allow you to setup  
a global set of gems as well as gems just for a particular project or  
use-case. By including a one-line text file in a directory, RVM can be  
told to automatically switch to this “gemset”, which sets the default  
version of ruby and loads the project-specific gems automatically.

RVM has many, many more features, and it just might be worth installing  
an easy-to-use Linux distro just to give it a try.

---

<div class="post-metadata">

**Author:** ![Jared\_Miller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jared\_Miller](https://www.ruby-forum.com/u/Jared_Miller)\
**Post date:** [October 1, 2010, 5:51pm UTC](https://www.ruby-forum.com/t/question-regarding-pik-ruby-jruby/195852/3 "2010-10-01T17:51:51Z")

</div>

> If you are using RVM it creates a â€˜rubyâ€™ symlink to jruby (see
> 
> > ~/.rvm/rubies/jruby-1.5.2/). Iâ€™m guessing in your case you installed JRuby  
> > by itself which wonâ€™t have created the symlink.
> 
> I would have thought that pik would do something similar, but I guess  
> not.

Yeah unfortunately it doesn’t. You could, however, create a file  
“ruby.bat” within your jruby\bin folder that just calls jruby, like:

jruby %\*

Then you’d have it.

> My other problem is that I can’t use jruby at all unless I go into  
> command  
> prompt and type \*pik use jruby.

Yeah you can only have one default, which is determined by your system’s  
PATH setting. If you were to add your jruby bin folder to the beginning  
of your path, you would then have it by default (as jruby). Pik doesn’t  
do anything but switch _away_ from the default. The default you must  
manually set up (I think, anyway). Another way to set up jruby as a  
default is to use their one click installer, and check the “setup my  
path for me” button.

GL.  
-r

> \*If I close command prompt, and open it  
> again, I have to do it all over. Below is just showing that I have to  
> _pik  
> use jruby_ and once it’s set to Jruby it won’t recognize _ruby -v_.
> 
> C:\Users\Jared\>ruby -v
> 
> ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
> 
> > C:\Users\Jared\>jruby -v
> 
> ‘jruby’ is not recognized as an internal or external command,
> 
> operable program or batch file.
> 
> > C:\Users\Jared\>pik list
> 
> 153: jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7)  
> (Java
> 
> > HotSpot™ Client VM 1.6.0\_21)…
> 
> 186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
> 
> > C:\Users\Jared\>pik use jruby
> 
> > C:\Users\Jared\>pik list
> 
> - 153: jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7)  
> (Java
> 
> > HotSpot™ Client VM 1.6.0\_21)…
> 
> 186: ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
> 
> > C:\Users\Jared\>jruby -v
> 
> jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7) (Java
> 
> > HotSpot™ Client VM 1.6.0\_21) [x86-java]
> 
> > C:\Users\Jared\>ruby -v
> 
> ‘ruby’ is not recognized as an internal or external command,
> 
> operable program or batch file.
> 
> ## Any thoughts, guys and gals?
> 
> Jared Miller
