jruby

How does one tell JRuby to reload/refresh a Java Class?

I am scripting Java using JRuby. By using JRebel, I can the automatically reload changed Java classes into the JRuby JVM without restarting. When I add a new Java method JRebel automatically reloads the class. My problem is that I cannot call this new method directly. Can I ask JRuby to refresh its method cache for the newly reloaded Jav...

How do you unpack gems using jruby on rails 2.3?

I'm trying to unpack all the system gems to end up with a standalone Rails directory including all the rails gems and all the system gems. I'm starting with a bare rails setup; just did a jruby -S rails and a 'generate jdbc'. I then add a config.gem 'jdbc-mysql' to environment.rb and do the jruby -S rake gems:unpack:dependencies. Afte...

Can I program for android using any JVM language?

Can I use other JVM languages besides Java (e.g. jruby, jython, clojure) to program for android, or is it java only? There was a similar question asked over a year ago but I wasn't sure if there'd been any change since then. ...

using ruby-debug with jruby-1.5.0

Release notes say that ruby-debug is installed by default. I'm using rvm. In my rails app I figured something as simple as script/server --debugger would suffice, but it complains that the ruby-debug gem isn't installed, suggests using gem install ruby-debug, which of course doesn't work (building native extensions) and is contrary to ...

packaging jruby script into jar with all dependencies ?

is there any way to make my currently jruby script into a standalone single executable like jar or exe ? ...

JRuby wrong element type class java.lang.String(array contains char) related to JAVA_HOME

I am on Ubuntu x64 bit running: java version "1.6.0_18" OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1) OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode) and jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2010-02-11 6586) (OpenJDK 64-Bit Server VM 1.6.0_18) [amd64-java] I have this code running on my Windows 7 computer...

Ruby/JRuby and WEBrick serving requests one at a time

Does anyone knows how to force WEBrick to process more than one request at a time? I'm using some Ajax on my page for long running database-related tasks and I can clearly see the requests are being processed in a pipeline. ...

JRuby gem problem

Hi, I am trying to run a rails application in Netbeans with JRuby as the underlying Ruby. When I try to run the server, I got an error like this, Missing these required gems: libxml-ruby So I tried installing the libxml-ruby gem, but I cannot install it because its a native version and jruby would not support it. Thats fine. (in...

Getting started programming in dynamic languages in Android ((J)Ruby, Clojure...)

I've been looking around, and I can't seem to find any definitive answer or headway that seems "up to date". I've seen some interesting projects like Duby, and am looking into it a bit. I've seen Jruby unsuccessfully used to compile ruby into .dex. I've also been looking, independently, into Clojure and have realized that they might a...

Error on creating war using warbler

Hi, i have a jruby application, and use warbler to make war files of it. But everytime i ran jruby -S rake war The warbler throw an error, it said can't convert nil to String and the error is in rubyzip, it happened when rake invoked war:jar, so how can i fix it ? do we have any other alternative to create war for jruby ? (beside the wa...

Where does the variable "p" get it's value from in ruby if it's not defined explicitly?

Question: Where does p get it's value from below and why does it happen? Consider this irb session: me@somewhere:~$ irb irb(main):001:0> a NameError: undefined local variable or method `a' for main:Object from (irb):1 irb(main):002:0> foo NameError: undefined local variable or method `foo' for main:Object from (irb):2 irb(main)...

Disallow ENV and ENV_JAVA in JRuby

Is it possible to disallow the use of ENV and ENV_JAVA in JRuby? I allow user supplied ruby code to run in servers, and I believe allowing them to use ENV and ENV_JAVA is not a very good idea. I was able to disallow the use of System.get/setProperty() using Java's Security Manager, but I haven't had much success in this case. Thanks i...

How do you call the main method of a java class from jruby?

Hi I am using JRuby to interact with a Java class. I have successfully imported the java class into my jruby program and created a new instance. However when I create the instance, I cannot call the main method. I can call every other method like object.method but I can't do object.main. How do I access the main method of a java class th...

Using Custom Java Class file in Jruby

I am trying to execute some custom Java code through the latest version of Jruby (1.5.1), Ruby 1.8.7, with Java 1.6.0_06. I have tried both the class file and putting it in a jar method. When I try require 'java' require 'path_to_class/myClass or require 'java' require 'path_to_jar/a_jar.jar Trying both methods, I cannot...

How can I set environment variables in glassfish for a specific application (or domain)

Okay here is my setup: Running JRUBY (and a JRuby on Rails application) on a glassfish server (not gem!!!). Jruby has been installed via RVM (http://rvm.beginrescueend.com/). The RoR application has it's own gemset. (managed by rvm) Now my problem is, that I don't know how to tell glassfish to use a different GEM_HOME and GEM_PATH env...

implementing custom java class in jruby

Hello, I am trying to implement a collection of java classes from the Stanford NLP Parser in jRuby I am able to implement regular Java in jRuby, but not the Stanford Parser classes #my requires/imports/includes, included multiple versions to be safe require 'java' include Java require 'c:\\stanford-parser\\stanfordparser.jar' require ...

setting rspec expectations on internal java method calls from jruby

I would love to be able to test java code with rspec under jruby, but can't see how to set expectations on internal java method calls. Given the following java: public class A { public String hi() { return hello(); } public String hello() { return "yo"; } } I would love to be able to do: describe 'A' do it 'should ...

Package Sinatra app into a single JAR file?

Hi everyone, I've an apparently (silly) simple question: With JRuby is it possible to deploy a single file Sinatra application? I mean: I've my Sinatra app with all needed gems exploded into some ./vendor/lib directory and I'd like to deploy the whole app as a single jar file to run on a deployment machine: $ java jar my_app.jar whe...

java tree class to XML through jRuby on rails

I have a custom Java Tree class (from stanford parser,) that I am able to work with in JRuby on Rails. What I am trying to figure out how to do is to output this tree class to XML through rails The tree class describes a word tree derived from a parsed sentence. Each tree may have multiple child trees depending on the structure Here i...

JRuby on Rails: Adding a folder to the classpath

I'm trying to add an entire folder to the JRuby 1.5 classpath for my Rails app. The JRuby Wiki suggests the following: "... add the config directory to the JRuby classpath in config/environment.rb:" $CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/" That doesn't seem to work for me. It doesn't matter whether...