开发者

Rake uses jruby instead of ruby after jruby install

I recently installed jruby 开发者_如何转开发on a machine that also has ruby installed on it. When I do

rake something it now appears to be using the jruby interpreter. I'd like rake to use the ruby interpreter. I'd appreciate any help.


What platform are you on? What's the output of which rake, which ruby, which jruby? How did you install jruby?

I'm going to go out on a limb and guess that however you installed jruby, it overrode your "pure" ruby binary. Depending on the platform and how jruby was installed, there are a number of ways this could have happened, e.g. PATH modification, update-alternatives, etc.

My /usr/bin/rake starts with:

#!/usr/bin/env ruby

So if I modified my PATH so that the jruby install directory came first and the jruby executable was aliased to ruby, then rake invokes /usr/bin/env ruby which invokes jruby.

The easiest solution (in a bash shell) is to do:

alias rake='/usr/bin/ruby /usr/bin/rake'

The downside is this solution will only help you and may or may not be available if you're trying to invoke rake from somewhere other than a shell prompt.

I hope that's enough to point you in the right direction.


Check your PATH environment variable ($PATH on *nix and %PATH% on Windows). When you type 'rake', the system will pick the first binary it finds in your PATH, so if jruby appears eariler in there, jruby's version of rake will be used.

The solution: adjust PATH variable and put jruby at the end of the PATH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜