views:

437

answers:

2

I've tried to use EventMachine etc., with JRuby. I get errors about native extensions. I believe this is due to Java limitations. I think the fact that I am on Windows further complicates the issue. Some clarification would be appreciated. What extensions can/can't be used with JRuby? How can I tell? Thanks.

+1  A: 

there is no really easy way to use native extensions in jruby. native extensions are calling c code that cant be called in jruby without implementing it in java. aside from that a few extensions are seeing jruby ports, for example EventMachine that you mentioned.

and as far as i know the only way to see if you can use a gem/extension with jruby is to read the docs, try it or read the source

LDomagala
+1  A: 

JRuby does not support native extensions, unfortunately, because they depend on specific memory and runtime details specific to the C implementation.
Usually you can find an equivalent library on the JVM that will work well as a replacement...

To complete LDomagala's answer, you can also refer to this thread related to the same "native extension" issue

Some installation script may rely on RUBY_PLATFORM to determine whether to build the native extensions depending on your OS. If you are on windows it will not build them.

The other way to avoid native compilation is using the ENV var 'NORUBYEXT'.

But that still may involve some tweaking in the ruby installation script...

VonC