Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:51:03+00:00 2026-05-25T12:51:03+00:00

Is it possible to set my jruby’s gem path from the ScriptEngineManager in Java?

  • 0

Is it possible to set my jruby’s gem path from the ScriptEngineManager in Java? The problem is that I’m using a compressed jruby interpreter (jruby-complete.jar) and it’s not possible to get this package with pre-installed gems, so what I’m trying do is running jruby from Java using the ScriptEngineManager and redirect the gem’s path to the ones that I have installed on my hard drive.

Example:

public class Main {
    public static void main(String[] args) {
        StringBuffer jruby = null;
        ScriptEngine runtime = null;

        try {
            runtime = new ScriptEngineManager().getEngineByName("jruby");
            jruby = new StringBuffer();

            jruby.append("require 'ruby/Libraries.rb'");
            jruby.append("\r\n");
            jruby.append("if __FILE__ == $0");
            jruby.append("\r\n");
            jruby.append("\tzkan = ZKANWritter.new(\"");
            jruby.append("G:/path/output.xls");
            jruby.append("\",\"");
            jruby.append("G:/path/kanban.txt");
            jruby.append("\",\"//path/LT CUU.tab\")");
            jruby.append("\r\n");
            jruby.append("\tzkan.write(2)");
            jruby.append("\r\n");
            jruby.append("end");

            runtime.eval(jruby.toString());
        } catch (Exception ex) {
            System.out.println("Error: " + ex.getMessage());
        }
    }
}

Thanks in Advance

~ Eder Quiñones

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:51:04+00:00Added an answer on May 25, 2026 at 12:51 pm

    I’ve just set the environment variables RUBYLIB & GEM_HOME programmatically from ruby:

    ENV["RUBYLIB"] = "lib/libs"
    ENV["GEM_HOME"] = "lib/gems"
    
    require "library-1.rb"
    ...
    require "library-n.rb"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java SE it is possible set the cause of an exception using initCause
Is it possible to set local repository path using profiles in Maven?
Is it possible to set property on each element from List using LINQ. for
Is it possible to set async: false when calling $.getJSON() so that the call
Is it possible to set 'MaxDegreeOfParallelism' (that is maximum number of threads to use)
Is it possible to set a default behaviour for custom (non-native) methods/functions in Java?
Is possible to set a DateTime object as optional parameter using now as default?
Is it possible to set the byte that a FileOutputStream points to? I have
Is it possible to conditionally set a dependency on a gem at install time?
Is it possible in easy way to convert JRuby Time/DataTime/Data into java.util.Calendar including the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.