- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个可以运行的网络应用程序,主要用于 MRI Ruby 和 JRuby。但是……
当我使用 MRI 时,我可以做到这一点。
> rails console
irb(main):001:0> a=Time.new(1,1,1,1,1)
=> 0001-01-01 01:01:00 -0500
即它为指定时间创建一个新的 Time 对象。
当我切换到 JRuby 时,我会这样做
> rails console
irb(main):001:0> a=Time.new(1,1,1,1,1)
ArgumentError: wrong number of arguments (5 for 0)
from (irb):2: in `evaluate`
from org/jruby/RubyKernel.java:1088 in `eval`
from /home/user/.rbenv/versions/jruby-1.6.4/lib/ruby/1.8/irb.rb:158 in `eval_input`
from /home/user/.rbenv/versions/jruby-1.6.4/lib/ruby/1.8/
....
如何在 JRuby 中创建一个时间对象,其中包含我控制的年、月、日、小时和分钟?如果是这样,它也可以与 MRI Ruby 一起使用吗?
我不知道这是否相关,但是
irb(main):002:0> RUBY_VERSION
"1.8.7"
我的问题可能是因为我处于 1.8.7 模式吗?如果是这样,我如何将我的 rbenv/jruby-1.6.4 安装切换为像 RUBY_VERSION=1.9.2 一样?
最佳答案
是的,跟RUBY_VERSION有关
您需要 JRUBY 处于 1.9 模式。
您可以通过 JRUBY_OPTS 进行设置
试试这个:
export JRUBY_OPTS=--1.9
或这个(在 Windows 上):
set JRUBY_OPTS=--1.9
示例 session (Windows):
> set JRUBY_OPTS=--1.9
> jirb
irb(main):001:0> a=Time.new(1,1,1,1,1)
=> 0001-01-01 01:01:00 +0918
关于Ruby 与 JRuby : Time. 新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7830404/
在 tomcat 内的 jruby/rack 中使用 jruby 时,如何/在哪里为 jruby 设置 --fast 模式? 此 --fast 模式在此页面中进行了说明 jruby performan
任何教程或博客都可以从 JRuby on Rails 开始 哪个指导我安装和小型 JRuby on Rails 应用程序? 我已经浏览了本演练和教程(https://github.com/jruby/
无法使用 jruby 启动 rails5,出现以下错误。 gavinyap@gavin-ubuntu ~/Development/rails5app rails s DEPRECATION W
我制作了一个 NSIS 脚本来为 Rails 应用程序创建安装程序。该应用程序使用 JRuby 和 Java。 在安装程序的第一部分中,我设置了环境变量:我将 jruby\bin 添加到 PATH 并
当我的 jruby 程序意外启动并向我提供堆栈跟踪时,这几乎是不可理解的。它充满了显然来自内部解释器的行,这让我很难弄清楚我的实际程序的实际调用堆栈是什么。 类似的东西(只是摘录): from
如何/在何处为在 jruby-rack/tomcat 中运行的 jruby 设置 --profile.api 选项? 此选项记录在如何分析代码块中 here 最佳答案 使用 JRUBY_OPTS 将无
我无法让 jruby 在没有 hack 的情况下使用 Rails 4: 在 railties/lib/rails/engine.rb 中,我必须用 const_get 初始化 Railties,否则
我需要将我的 JRuby 应用程序编译成一个独立的 JAR 文件。我怎样才能做到这一点? 最佳答案 Warbler 1.3.0 或更新版本也可用于制作可执行 JAR 文件。 快速说明。确保您在此处使用
我正在尝试将 Rails 应用程序转换为 jruby on Rails。目前,jruby script/delayed_job run给出: /usr/lib/jruby/lib/ruby/gems/
我通过在 config/application.rb 中添加了一些外部 jar 到我的 CLASSPATH : require 'java' $CLASSPATH << "#{File.dirname
目前在 Jruby 中编写类似的 java 类时遇到问题。 示例: 在 Java 中: public class Client extends ClientConnection { //do s
jruby 1.7.23 (1.9.3p551) 2015-11-24 f496dd5 在 Java HotSpot(TM) 64 位服务器 VM 1.7.0_79-b15 +jit [Windows
我正在尝试通过最新版本的 Jruby (1.5.1)、Ruby 1.8.7 和 Java 1.6.0_06 执行一些自定义 Java 代码。我已经尝试了类文件并将其放入 jar 方法中。当我尝试 re
文档似乎表明,为了将 Java 类导入到 JRuby 中,它们必须位于 JAR 文件中: “为了使用 JRuby 中的 jar 文件中的资源,jar 文件必须位于类路径上,或者您可以使用 requir
我在 Windows/JRuby 上使用 watir-webdriver。我的开发一直使用 Firefox。 Watir::Browser.new :firefox 对于部署,我需要一个 headle
我正在使用 JRuby 编写 Java 脚本。通过使用 JRebel,我可以自动将更改的 Java 类重新加载到 JRuby JVM 中,而无需重新启动。当我添加一个新的 Java 方法时,JRebe
我试图在 JRuby 中传递一个二进制字符串作为 byte[]通过一些Java库并再次进入JRuby,我想将其转换回字符串,但我无法弄清楚如何在不弄乱字符串的情况下进行操作。 具体来说,我将 Ruby
在Java中运行Ruby脚本时,我们使用ScriptEngine jruby = new ScriptEngineManager().getEngineByName("jruby");,如果只需要调用
当前的 Trinidad gem 依赖于 jruby-rack 1.1.0,它在我的每一项 Assets 的开发日志中显示了一些错误 /Users/bijan/.rvm/gems/jruby-1.7.
环境 JRuby 版本:jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64 位服务器 VM 25.65-b01,位于 1.8.0_
我是一名优秀的程序员,十分优秀!