jruby

what do these ruby warnings mean ?

cqq.rb:96 **warning: Statement not reached.** /root/newpackage/lib.rb:727 **warning: instance variable @object not initialized** Error: Your application used more memory than the safety cap of 500m. Specify -J-Xmx####m to increase it (#### = cap size in MB). Exception trace follows: java.lang.OutOfMemoryError: Java heap space curiosu...

hpricot in netbeans

hi I am trying to use hpricot in JRuby. My problem is the following. If I have this code: #!ruby require 'hpricot' require 'open-uri' # load the RedHanded home page doc = Hpricot(open("http://redhanded.hobix.com/index.html")) where do I put it? Into my controller? Because its not accepting it there. And if I'm supposed to put it...

Casting objects in JRuby

Is there a way I can explicitly cast one Java object to another Java class from JRuby? Sometimes I want to be able to invoke SomeJavaClass#aMethod(MySuperClass) rather than SomeJavaClass#aMethod(MyClass) from JRuby. From Java, I'd do this: someJavaObject.aMethod( (MySuperClass) myObj ); but I didn't see a #cast ruby method or an...

warbler config and jruby version

I just installed jruby-1.4.0 to play around with it. I'm noticing however that warbler is packaging this by default with my rails deploy. My production uses jruby-complete-1.3.1 (which I've added to my lib dir to freeze the version) but warbler is adding jruby-core-1.4 when it packages everything up. That's a bit worrisome for me as I...

running nokogiri in Jruby vs. just ruby

I found startling difference in CPU and memory consumption usage. It seems garbage collection is not happening when i run the following nokogiri script require 'rubygems' require 'nokogiri' require 'open-uri' def getHeader() doz = Nokogiri::HTML(open('http://losangeles.craigslist.org/wst/reb/1484772751.html')) puts doz.xpath("html[1]...

running "ruby something.rb" in each loop

is there a problem with doing? will there be some constraint on resources? #main.rb (1..100000).each do |loop| `ruby dosomething.rb` end The reason i am doing this is because main.rb needs to be run in Jruby. Somescript.rb runs faster using less resource in just Ruby, hence i am running it as shell command. ...

possible to load nokogiri in jruby without installing nokogiri-java ?

i need a way to run following nokogiri script #parser.rb require 'nokogiri' def parseit() //... end and call the parseit() while running below main.rb in jruby #main.rb require 'parser' parseit() Of course the problem is jruby cannot find 'nokogiri' as I have not installed it aka nokogiri-java via jruby -S gem install nokogiri T...

(J)Ruby full locales/localisation/cultureInfo support

Hi, Does (J)Ruby support such things like Calendar in Java or CultureInfo in .NET? I want to be able to write code in Ruby similar to this: locale = Locale.new("en-GB") date1 = "30/12/2000".to_date(locale) locale = Locale.new("en-US") date2 = "12/30/2000".to_date(locale) Locale.current = "ru-RU" date2 = "30.12.2000".to_date # uses t...

Installing gems from behind a corporate firewall

I suspect that the corporate firewall is preventing gems from getting installed. I have HTTP_PROXY defined and I'm able to view remote gems via the following command: jruby -S gem list -r But when I go to install a gem, I get a 404: jruby -S gem install rails Is there a good workaround for resolving this issue other than maintainin...

Compile jruby "Hello world" problem

I have been programming for a while with Ruby and I really enjoy it. Lately I started having the need of compiling some ruby code. For several reasons using Ruby2exe is not an option for me. So I decided to give Jruby a try (generating a jar would be good enough). I am using windows and I installed java JDK 6u17 (at C:\Program Files\Jav...

Warbler config.java_classes and log4j.properties

I'm packaging up a rails app with warbler and I want app specific logging. I've added the log4j and commons-loggin jar to the WEB-INF/lib directory, and I want to add log4j.properties to the WEB-INF/classes directory. The problem is, I also want environment specific logging, so my staging/production use different properties (ie. INFO i...

Glassfish can't find activerecord-jdbc-adapter

I'm trying to deploy simple Rails app on glassfish v3 and get the following error: org.jruby.rack.RackInitializationException: Could not find RubyGem activerecord-jdbc-adapter (>= 0) Environment details: App is packaged as war using warbler. JRuby 1.4.0 installed locally, with activerecord-jdbc-adapter gem installed. App is configured...

JRuby app throws exception in Spring

I am trying to run a JRuby app in Spring. I use Eclipse to run it. But it doesn't compile. Does anybody know what's going on here? Exception in thread "Launcher:/oflaDemo" [INFO] [Launcher:/oflaDemo] org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support...

problem installing ruby-debug-ide gem with jruby 1.4.0

Hello, I tried to follow the UsingTheJRubyDebugger instructions on the jruby wiki. (kenai.com/projects/jruby/pages/UsingTheJRubyDebugger). I got an error trying to install the ruby-debug-ide gem. jruby -S gem install --ignore-dependencies ruby-debug-ide JRuby limited openssl loaded. gem install jruby-openssl for full support. http://...

Anybody has luck running Rails application on Weblogic using JRuby?

My application is developed on Rails 2.3.5, its running fine on Webrick, Mongrel, Tomcat and Glassfish. But when I try to the run the same war file that was generated using warbler gem in Weblogic, I am getting the following error: Application initialization failed: no such file to load -- rack from C:/bea/wlserver_10.3/samples/domai...

How best to package rubygems in addition to jruby-complete.jar?

As developing an Java application bundled with 'jruby-complete.jar', it is desired not to put required rubygems localally, but instead packaged it along with the application. Obviously we don't want to touch 'jruby-complete.jar'. What's the better way of packaging these rubygems? ...

jruby public database adapter

Hi I'm trying to deploy my rails application from jRuby to Heroku The db is giving me problems: $ heroku db:push Auto-detected local database: jdbcmysql://root:password@localhost/product_develo pment?encoding=utf8 Failed to connect to database: Sequel::AdapterNotFound -> Could not load jdbcmysql adapter: no such file to load -- /us...

Proper jruby syntax for requiring java and including java classes

I can't seem to find what the current syntax for using java classes in Jruby is. This link text article lists: include Java include 'java' require 'java' As valid options, though it says the last option is pre 1.0 and doesn't work. The Jruby Wiki however says to use require 'java' And for including classes I've seen MyClass = Java::...

How to force Jruby to use inbuilt Ruby 1.9 instead of Ruby 1.8 which is default?

I have developed a Ruby on Rails application and successfully deployed on Weblogic using Jruby and Warbler (which creates a war file based on the settings in config/warble.rb). I believe although Jruby comes with inbuilt Ruby 1.8 and 1.9, by default it uses 1.8 and I want to test the same rails application in Ruby 1.9 within JRuby as I...

Netbeans doesnt pick up Java classes in debugger

This is doing my head right in! I am messing about with JRuby trying to make some Java calls. Here is the source Im messing with. require 'java' module JavaLang include_package "java.lang" end module JavaSql include_package 'java.sql' end begin JavaLang::Class.forName("com.mysql.jdbc.Driver").newInstance jdbcconnection =...