jruby

JAR generated by warbler cannot access included internal JAR library

守給你的承諾、 提交于 2019-12-08 06:19:32
问题 I have a JRuby project that connects to an Oracle database using JDBC via Oracle's ojdbc6.jar library. The code works well when run using JRuby 1.6.6 on Windows 7 and JRuby 1.6.5.1 on OS X Lion. I'm trying to create a standalone JAR file using warbler. After running warble jar it includes the ojdbc6.jar but for some reason it does not load/access it. It seems the internal classpath is incorrect or I'm not configuring something right. Following directory structure exists. C:\my_jruby_project

Porting a Ruby/Rails/MRI app to JRuby

安稳与你 提交于 2019-12-08 04:37:32
I have a Ruby/Rails devvelopment environment using rbenv, MRI Ruby (1.9.2-p290), rails 3.0.9, and SQLite3. I would like to port it to JRuby, but do it such that I don't have to do anything more than run "rbenv local jruby-1.6.4" and "rails server" in the root directory of the Rails application to use it with JRuby, and "rbenv local 1.9.2-p290" and "rails serer" to use it with MRI Ruby. I am aware that the gems to access SQLite are different for Ruby versus JRuby, but how do you write the Gemfile such that the MRI-relevant gems are picked up when the Ruby is MRI, and the JRuby-relevant gems are

Cross-Implementation Deterministic Array#shuffle

≯℡__Kan透↙ 提交于 2019-12-08 02:56:19
问题 It is possible to pass a random number generator to Array#shuffle that makes the shuffle deterministic. For example, in MRI 1.9.3p327: [1, 2, 3, 4].shuffle(random: Random.new(0)) # => [1, 2, 4, 3] [1, 2, 3, 4].shuffle(random: Random.new(0)) # => [1, 2, 4, 3] However, the random number generator implementation of Random isn't specified. Because of this, other implementations of Ruby have different results. In Rubinius 2.0.0rc1 (1.9.3 release 2012-11-02 JI): [1, 2, 3, 4].shuffle(random: Random

Anyone using JRuby-Rack with Rails 3?

三世轮回 提交于 2019-12-08 02:18:34
问题 Is anyone else out there running Rails 3 and JRuby-Rack, or Jetty and Rails 3? Any trick to it? I'm going insane with some debugging, and at this point I just want to know that it's possible. 回答1: These instructions work for me: http://mathias-biilmann.net/2010/2/jruby-and-rails-3-beta-step-by-step 回答2: i am using jetty-rails + rails3 for a couple of projects. jetty-rails need to be fixed , require "activesupport" need to be changed to require "active_support" (for activesupport 3.0.3) and

JRuby: command pattern in Java with Ruby block: why does it work?

家住魔仙堡 提交于 2019-12-08 02:06:06
问题 I am learning how to integrate Java library with Ruby code and come to the following question. I have a command pattern implemented in Java, as follows: public interface Command { public String execute(String param); } public class CommandRunner { public String run(Command cmd, String param) { return cmd.execute(param)+" [this is added by run method]"; } } When I import that to JRuby program I can implement Ruby class that respond_to? :execute with one parameter and pass it to the

Cucumber 0.4.3 (cuke4duke) with java + maven gem issues

限于喜欢 提交于 2019-12-07 21:45:05
问题 I recently embarked on installing a sample project for cucumber and tried running it with maven + java. I followed this guide http://www.goodercode.com/wp/using-cucumber-tests-with-maven-and-java/ First issue was when I run mvn cuke4duke:cucumber -DinstallGems=true I was getting an issue running gem command from the jruby-complete-1.5.6 jar I installed JRuby1.5.6 and installed the cuke4duke gem myself to the maven repository. Now when I run the command above I get an error in the script file

Warbler: Where are my images

岁酱吖の 提交于 2019-12-07 20:05:29
问题 I'm using Jruby and Warbler to deploy a Jruby on Rails application to a Tomcat server. I can see all of my images when I deploy the server with Webrick: jruby -S server/script. However, when I create a .war file out of the rails directory using jruby -S warble and deploy to Tomcat, none of my images show up on the tomcat server. I noticed that image location has changed to the root of the directory in the war file. It seems that /images/picturename.jpg would be appropriate, but my images are

JRuby calls the wrong method

泪湿孤枕 提交于 2019-12-07 13:49:12
问题 I got a strange problem with a call to a Java method from JRuby. In my Java class these methods are defined twice, and it appears JRuby calls the wrong one. So I tried to use java_method , but I always got a: TypeError: cannot convert instance of class org.jruby.RubyModule to class java.lang.Class Here's my Java code: public class Renderer { ... public void addRenderer(IElementRenderer r) { System.out.println("Added element render: " + r.getClass().toString()); basicRenderers.add(r);

How do you update JRuby's gem command?

青春壹個敷衍的年華 提交于 2019-12-07 10:02:55
问题 How do we update the version of gem that JRuby uses? JRuby uses gem (1.5.1) and we would like to upgrade it to 1.8.7. We want to have the gems installed in Ruby/gems We run: bin/jruby gem install rubygems-update Fetching: rubygems-update-1.8.5.gem (100%) Successfully installed rubygems-update-1.8.5 1 gem installed bin/jruby gem install --system ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --system (update does not work either) bin/jruby gem update --system

What languages are mature to develop native apps in Android [except Java]

蹲街弑〆低调 提交于 2019-12-07 06:46:02
问题 Is there a languages other then Java to develop native apps in android without script layer/AIR and others 3rd party abstractions. Mostly im interested in Clojure,JRuby, Scala 回答1: Since Scala is compiled to native JVM bytecode, it could be use to develop native Android apps. The biggest problem is that using 3rd party library is not that easy in Android development, and you need use proguard to reduce the size of your program, sometimes this will cause problem. But it is still feasible to