Jruby rackup jvm

Anyone know of a way to add java directives to the JVM before rackup
invokes ruby.

I mean should I be looking at the rackup script or something in rvm or
perhaps ENV.

I’ve googled without much success.

Thanks,

Guy

On Nov 8, 2010, at 04:12 , Guy B. wrote:

Anyone know of a way to add java directives to the JVM before rackup invokes
ruby.

I mean should I be looking at the rackup script or something in rvm or perhaps
ENV.

You could certainly try putting some custom code at the top of your
rackup script.

Also, as of Warbler 1.2.1 and JRuby-Rack 1.0.3, there’s a special
‘META-INF/init.rb’ file that gets evaluated early in the JRuby-Rack
boot-up sequence. You could try putting your initialization code in
there. See “config.init_contents” in Warbler as follows:

Warbler::Config.new do |config|
config.init_contents << StringIO.new(“require ‘custom_library’;
require ‘java’; java.lang.System.setProperty(‘a’, ‘b’)”)
end

/Nick

On 08/11/2010 23:24, Nick S. wrote:

/Nick
I had hoped that someone had seen and solved this before.

Perhaps I should explain a bit more.

We call the rackup command directly in our plists. We do not use a java
servlet container just rvm, jruby, rack and sinatra.

In the local boxes we often just type in ‘rackup config_dev.ru’.

This works - ruby --server ~/.rvm/gems/jruby/1.4.0/bin/rackup
./config_dev.ru.

But hard coding the rvm path to rackup is undesireable.

After further experimentation it it looks like setting an environment
variable JAVA_OPTS=-server shows promise.

Also the plist can set this per rackup invocation. However, to make
full use of the ServerVM we need to upgrade away from jruby 1.4.

/Guy