32 questions
1
vote
1
answer
157
views
jruby does not understand import statement
I'm converting a project written with JRuby 1.7 in mind to JRuby 9.4. One of the files starts like this:
if RUBY_PLATFORM == 'java'
require 'java'
import java.lang.management.ManagementFactory
...
2
votes
1
answer
341
views
Plese help me understand JRuby method name conversion inconsistensies
Recently I've cobbled together a small project to play with JRuby and its interactions with Java. Here's the Github gist.
LogicProcessor.java:
package me.artsolopov.jrp;
import javax.swing.*;
import ...
2
votes
1
answer
344
views
Java Reflection: Determining class of java.util.regex.Pattern in JRuby
Working on a legacy JRuby app (1.6.8) running under Java 11, I traced a peculiar error a test case: "require 'java'; puts java::util::regex::Pattern.class" errors ArgumentError: wrong number of ...
7
votes
1
answer
401
views
Can you use gems, when you execute a Ruby script in embedded JRuby?
It so happened that I need to unit-test this Ruby script. It's a Sinatra-based web application that uses several gems.
I have more experience in Java than in Ruby, time is very important (and ...
0
votes
2
answers
98
views
Use gems with c-extensions in JRuby, or port them to Java?
I'm doing a fuzzy match test between an input string and some previously entered strings. The test is performed live while typing.
I already have a shockingly accurate algorithm in place called ...
7
votes
0
answers
207
views
ScriptingContainer, Ruby Runtime and Variable Map
(Crossposting note: This question has also been posted at the JRuby
mailing list ([email protected]) on December 20 and on JRuby Forum on January 2nd, but hasn't got any
response yet).
This ...
0
votes
1
answer
419
views
JRuby file not run when executing from jar file (was: System.out.println not working from jar file)
(Crossposted at JRuby Forum, but posted here again because I did not get any answer yet).
Platform: jruby 9.0.4.0 (2.2.2) 2015-11-12 b9fb7aa Java HotSpot(TM) 64-Bit Server
VM 24.79-b02 on 1.7.0_79-...
1
vote
1
answer
1k
views
Access enums from Jar file in Jruby
I'm trying to access the following static enum
public class Colors
{
public enum ListofColors
{
BLUE, RED, YELLOW
}
}
But I keep getting the error
NameError: cannot load Java ...
0
votes
1
answer
200
views
JRuby proc as a Java interface implementation
My question is related to closure conversion. I want to test a proc that implements a functional interface from jruby code.
I have a simple proc like
proc { print 'hey!' }
to implement a java ...
3
votes
2
answers
164
views
byte[] to RubyString for string xor in JRuby Java Extension
I'm trying to implement a Java extension for JRuby to perform string xors. I'm just uncertain how to type cast a byte array into a RubyString:
public static RubyString xor(ThreadContext context, ...
1
vote
2
answers
2k
views
How do I use JRuby and Java?
Is that feature still supported? I can't seem to find any Documentation past 2008 or so. This is an insert from the Oracle website...
At runtime, the JSR 223 Scripting APIs must locate the ...
0
votes
1
answer
793
views
Debugging between JRuby and Java
I have a large Java project that uses some Ruby scripts (primarily because of Ruby's support for "yield"). The Ruby code calls Java code which calls more Ruby code. It's very interleaved, but ...
2
votes
1
answer
836
views
How can I force JRuby to initialize a java ArrayList with java Longs instead of Fixnums?
Someone on my team is writing a ruby/cucumber test that calls a java api that takes a List<Long> argument. I'm trying to help him out but my jruby knowledge is pretty limited. Whenever the ...
1
vote
0
answers
60
views
Same process id for exec in ruby script
Is there anyone know the implementation of exec by JRuby implementation.
I have two simple rubys scripts: Test.rb calls another called.rb via exec, as below:
//Test.rb
#!/usr/bin/env jruby
sleep ...
0
votes
2
answers
117
views
Search for a pattern in a file and print it in jruby
I have a file with n number of lines. I need to search for a field(SessionId and its value) in it and print its corresponding value.
I have coded to access the file and print it line by line. Need ...