jruby

Ruby code to JAR

折月煮酒 提交于 2019-12-03 04:08:23
I'd like to be able to compile a ruby program to a java JAR program. I've looked into JRuby and seen several examples of Java applications that would be able to eval() ruby code, but is there a more elegant solution allowing to simply code everything in ruby and then compile the lot directly to a JAR file? The overall goal behind that is to be able to extend a security tool called Burp Proxy. So I'd like to be able to use all my Ruby pentesting scripts (obviously organising them so they interface with Burp extender) and compile my plugins to JAR file that can be executed by the tool. If you

Groovy advantages over Jython or Jruby?

感情迁移 提交于 2019-12-03 01:41:15
问题 Why would I choose to use Groovy when I could use Jython or Jruby? Does the language provide any inherent advantages to make up for the fact that Jython and Jruby skills are applicable to their parent languages outside of the JVM? Keep in mind that I purposely keeping this question generic, but if there are any advantages that exist in a particular domain, please don't hesitate to describe them. EDIT To clarify, If I write some code in Jruby, I can now, in some cases, move that code outside

JRuby on Rails vs. Ruby on Rails, what's difference?

故事扮演 提交于 2019-12-03 00:22:05
问题 I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. What's the differences I need to look out for? 回答1: JRuby is the Ruby implementation that runs on a JVM whereas Matz's Ruby is a C implementation. Key features to note are: JRuby runs on Java VM's and it's either compiled or interpreted down to Java byte code. JRuby can integrate with Java code. If you have Java class libraries (.jar's), you

java.lang.OutOfMemoryError: Java heap space

痞子三分冷 提交于 2019-12-02 20:43:17
while using Jruby, i get this message. Complete Java stackTrace java.lang.OutOfMemoryError: Java heap space how to resolve ? TLDR: jruby -J-Xmx1024m script_you_want_to_run.rb As others have mentioned, your program is trying to allocate more memory than the max size the JVM is allowed to allocate. Also as others have mentioned, you can configure Java to allow more memory allocation by telling it via the command line with the argument -Xmx1024m (as an example). -Xmx is the argument for max memory, and the 1024m would be the memory size (the final m for megabytes). I think JRuby starts the JVM

Does Scala scale better than other JVM languages?

左心房为你撑大大i 提交于 2019-12-02 20:02:33
Here is the only way I know to ask it at the moment. As Understand it Scala uses the Java Virtual Machine. I thought Jruby did also. Twitter switched its middleware to Scala. Could they have done the same thing and used Jruby? Could they have started with Jruby to start with and not had their scaling problems that caused them to move from Ruby to Scala in the first place? Do I not understand what Jruby is? I'm assuming that because Jruby can use Java it would have scaled where Ruby would not. Does it all boil down to the static versus dynamic types, in this case? Scala is "scalable" in the

Rails Schema creation problem

女生的网名这么多〃 提交于 2019-12-02 19:39:18
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 => 'ENGINE=MyISAM') do |t| t.string :title t.text :body t.timestamps end execute "alter table notes ADD FULLTEXT(title, body)" end Here is what it produces on in schema.rb create_table "notes", :force => true do |t| t.string "title" t.text "body" t.datetime "created_at" t.datetime "updated_at" end add_index "notes", ["title", "body"], :name => "title" I have two

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

跟風遠走 提交于 2019-12-02 18:31:08
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 doing other things. Normally, I'd just go use Java's SecurityManager and be done with it. That's pretty simple and lets me restrict file and network access, the ability to shutdown the JVM, etc. And that will work well for the high level stuff I want to block off. But there is some stuff I want to allow, but only via my custom API/library that I've

JRuby on Rails vs. Ruby on Rails, what's difference?

拈花ヽ惹草 提交于 2019-12-02 14:02:20
I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. What's the differences I need to look out for? user23117 JRuby is the Ruby implementation that runs on a JVM whereas Matz's Ruby is a C implementation. Key features to note are: JRuby runs on Java VM's and it's either compiled or interpreted down to Java byte code. JRuby can integrate with Java code. If you have Java class libraries (.jar's), you can reference and use them from within Ruby code with JRuby. In the other direction you can also

How do I do ASCII to EBCDIC translation in Ruby?

﹥>﹥吖頭↗ 提交于 2019-12-02 13:38:29
问题 I am using Ruby 1.8.7 on Mac OS X. How do I convert ASCII to EBCDIC encoding, to communicate with legacy system. Would I have to use to jruby? 回答1: You can upgrade but that doesn't necessarily solve the problem. There are multiple flavors of EBCDIC (THANK YOU IBM!) so you'll need to identify the subset your mainframe uses. One thing I learned to do when programming on the mainframe, oh so many years ago, was to call some of the mainframe sysops, and pick their brains. They deal with

How to get from JRuby a correctly typed ruby implementation of a Java interface?

◇◆丶佛笑我妖孽 提交于 2019-12-02 13:38:10
I'm trying to use JRuby (through the JSR233 interface included in JRuby 1.5) from a Java application to load a ruby implementation of a Java interface. My sample implementation looks like this: Interface: package some.package; import java.util.List; public interface ScriptDemoIf { int fibonacci(int d); List<String> filterLength(List<String> source, int maxlen); } Ruby Implementation: require 'java' include Java class ScriptDemo java_implements some.package.ScriptDemoIf java_signature 'int fibonacci(int d)' def fibonacci(d) d < 2 ? d : fibonacci(d-1) + fibonacci(d-2) end java_signature 'List