I'm using JRuby because it's better for SRS Ruby on Rails, on Windows.
My solution was to use jirb
in cmd.exe or Powershell (not gitbash).
I've tried:
$ rails console
Loading development environment (Rails 4.2.4)
Switch to inspect mode.
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully.
require at org/jruby/RubyKernel.java:939
<top> at bin/rails:4
and:
$ bundle exec rails console
uri:classloader:/jruby/kernel/kernel.rb:17: warning: unsupported exec option: close_others
Loading development environment (Rails 4.2.4)
Switch to inspect mode.
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully.
require at org/jruby/RubyKernel.java:939
<top> at bin/rails:4
and:
$ jruby.exe -S bundle exec rails console
uri:classloader:/jruby/kernel/kernel.rb:17: warning: unsupported exec option: close_others
Loading development environment (Rails 4.2.4)
Switch to inspect mode.
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully.
require at org/jruby/RubyKernel.java:939
<top> at bin/rails:4
I tried the solution "Load error when running rails console", but restarting the computer has no effect. bin/spring has no mention of GEM_HOME
. I reinstalled Rails and Spring.
Is this because of JRuby?
I'm entertaining the idea that jruby -S rails console
requires C extensions. I found another way to access the console using JRuby's own jirc. I started with:
$ jirb
Switch to inspect mode.
then edited ~/.irbrc to include
IRB.conf[:PROMPT_MODE] = :SIMPLE
which produced:
$ jirb
Switch to inspect mode.
>>
which then immediately exits. Doing this:
$ jirb puts 'hello'
Switch to inspect mode.
Errno::ENOENT: No such file or directory - puts
initialize at org/jruby/RubyFile.java:342
open at org/jruby/RubyIO.java:1124
open at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/magic-file.rb:7
initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/input-method.rb:100
initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/context.rb:84
initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb.rb:426
start at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb.rb:381
<top> at G:/jruby-9.0.1.0/bin/jirb:13
Since my console is still not working and nothing about jirc is using C extensions, the question is not a duplicate to that one.
TL;DR use jirb
in Command Prompt to execute Ruby code.
I never resolved making rails console
work. This may have to do with my ruby installation being a part of jRuby.
However, irb
and jirb
allow me to execute Ruby snippets on the command line with either Command Prompt or Powershell. GitBash doesn't work, says Switch to inspect mode.
followed by >>
and then exits.