Questions tagged [jruby]

JRuby is an open-source Java implementation of the Ruby programming language. It is Ruby for the JVM. Using idiomatic Ruby syntax, JRuby can consume Java classes and libraries with ease.

JRuby is an open-source Java implementation of the Ruby programming language. It is Ruby for the JVM. Using idiomatic Ruby syntax, JRuby can consume Java classes and libraries with ease.

The tight integration of JRuby with the JVM affords JRuby many advantages which include concurrency, native threads, a mature and efficient garbage collector and significant performance boosts via JIT compilation.

2833 questions
12
votes
4 answers

Can't launch simple Sinatra app using rackup and jRuby (no response from web server)

I've got a Sinatra "hello world" app that I am trying to run using jRuby. It works when I run the app, but not when I run rackup. Can anyone tell me what is going on here? Here's the app, in a file 'app.rb': require 'rubygems' require…
Andy Jones
  • 1,074
  • 1
  • 10
  • 21
12
votes
1 answer

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…
rampion
  • 87,131
  • 49
  • 199
  • 315
12
votes
6 answers

Is it possible to compile a Rails app to a Java VM JAR file?

Essentially the only thing I can deploy to my deployment machine is a JAR file. I can't install JRuby, nor can I install Glassfish or Tomcat. Is it possible to package up a Rails application (including Rails, vendored, of course) to a JAR file such…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
11
votes
3 answers

Security with Java Scripting (JRuby, Jython, Groovy, BeanShell, etc)

I'm looking to run some un-verified scripts (written in a yet-to-be-determined language, but needs to be Java-based, so JRuby, Groovy, Jython, BeanShell, etc are all candidates). I want these scripts to be able to do some things and restricted from…
Patrick Lightbody
  • 4,424
  • 2
  • 28
  • 38
11
votes
1 answer

How to enable colors with rspec when using JRuby or bundle exec?

I'm trying to run my rspec's with JRuby: rake spec which results in: jruby -S bundle exec rspec --color spec/foo_spec.rb No colors show up, so I removed Jruby from the equation: bundle exec rspec --color spec/foo_spec.rb no colors. How can I get…
codecraig
  • 3,118
  • 9
  • 48
  • 62
11
votes
6 answers

Java Backend and Rails Frontend

I have a startup considering building a Java backend and a Rails frontend. The Java backend will take care of creating a caching layer for the database and offer other additional services. The Rails frontend will mostly be for creating the webapp…
Ian
  • 111
  • 1
  • 3
11
votes
6 answers

Rails Schema creation problem

I am using Jruby and rails 2.2.2. My problem is I have a migration that is not being correctly written to the database schema. Here is my migration: class CreateNotes < ActiveRecord::Migration def self.up create_table(:notes, :options =>…
Josh Moore
  • 13,338
  • 15
  • 58
  • 74
11
votes
1 answer

Accessing a variable fom the JRuby script top-level environment from Java

jruby 1.7.23 (1.9.3p551) 2015-11-24 f496dd5 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_79-b15 +jit [Windows 7-amd64] I run a scriptlet in my scripting container like this: (RubyObject) ro =…
user1934428
  • 19,864
  • 7
  • 42
  • 87
11
votes
2 answers

Using JRuby/Jython for Ruby/Python interoperability?

Quite-probably a silly question, as I don't know much about Java/Jython/JRuby/bytecode, but.. I stumbled across _why's unholy again today.. It allows you to output Python bytecode from Ruby code.. Basically allowing them to produce the same…
dbr
  • 165,801
  • 69
  • 278
  • 343
11
votes
2 answers

Rails console issues using JRuby: no prompt character, no tab completion, broken arrow keys, etc

I'm having various issues with my Rails console under JRuby, including No prompt character Tab completion not working (literal tab gets inserted) Up/down arrows not browsing history (^[[A or ^[[B gets inserted, respectively) Left/right arrows not…
Abe Voelker
  • 30,124
  • 14
  • 81
  • 98
11
votes
4 answers

Why does logstash take so long to start/load?

Edit : I changed the title because the issue was not what I initially thought. The fact is that logstash takes more than a minute to starts, which can be misinterpreted as "silence"... I'm trying to make logstash running, so I've followed the…
Orabîg
  • 11,718
  • 6
  • 38
  • 58
10
votes
3 answers

How do you open a single project for Java, Scala and JRuby in Eclipse?

I was able to get all three running a Hello World in a "Scala Project" with a .java file as my main. The problem is that it is pulling from a "Java Project" I am not using, though I have the JRE System Library in my "Scala Project". Here is the…
Shane
  • 1,629
  • 3
  • 23
  • 50
10
votes
5 answers

How do I use JRUBY_OPTS with RVM?

It seems that the idiomatic way to provide flags to JRuby in an RVM-based Rails project is to set the environmental variable JRUBY_OPTS or PROJECT_JRUBY_OPTS, the latter perhaps being done automatically, since I see I can uncomment this line from my…
Paul Biggar
  • 27,579
  • 21
  • 99
  • 152
10
votes
2 answers

big array manipulation is very slow in ruby

I have the following scenario: I need to figure out the unique list of ids across a very large set. So for example, I have 6000 arrays of ids (followers list), each can range in size between 1 and 25000 (their follower list). I want to get the…
Joelio
  • 4,621
  • 6
  • 44
  • 80
10
votes
4 answers

Logging in Rails with a per-request ID

I'm looking for a quick and easy way to generate a unique per-request ID in rails that I can then use for logging across a particular request. Any solution should ideally not make too much use of the default logging code, as I'm running the…
cbz
  • 1,696
  • 1
  • 15
  • 19