Konloch/bytecode-viewer · error · Exception

Cannot find jRuby script engine! Please contact Konloch.

Error message

Cannot find jRuby script engine! Please contact Konloch.

What it means

Thrown by RubyPluginLaunchStrategy.run when ScriptEngineManager.getEngineByName("jruby") returns null, meaning no JRuby script engine is registered. BCV cannot evaluate the Ruby plugin, so it throws immediately with a contact-the-author message. This is a dependency/classpath problem, not a problem with the plugin script itself.

Source

Thrown at src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java:45

import java.io.FileReader;
import java.io.Reader;

/**
 * @author Konloch
 * @author Bibl (don't ban me pls)
 * @since 1 Jun 2015
 */
public class RubyPluginLaunchStrategy implements PluginLaunchStrategy
{

    @Override
    public Plugin run(File file) throws Throwable
    {
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("jruby");

        if (engine == null)
            throw new Exception("Cannot find jRuby script engine! Please contact Konloch.");

        Reader reader = new FileReader(file);
        engine.eval(reader);

        return (Plugin) engine.eval(file.getName().replace(".rb", "").replace(".ruby", "") + ".new");
    }
}

View on GitHub (pinned to 31430e0033)

Solutions

  1. Add org.jruby:jruby-complete (which registers the JSR-223 engine) to the classpath
  2. Enumerate new ScriptEngineManager().getEngineFactories() to verify the "jruby" name is registered
  3. Rebuild the jar without excluding META-INF/services entries
  4. Pin a JRuby version compatible with your JDK if the engine fails to initialize

Example fix

// before (pom.xml, missing engine)
<!-- no jruby dependency -->
// after
<dependency>
  <groupId>org.jruby</groupId>
  <artifactId>jruby-complete</artifactId>
  <version>9.4.5.0</version>
</dependency>
Defensive patterns

Strategy: fallback

Validate before calling

ScriptEngine engine = new ScriptEngineManager().getEngineByName("jruby");
if (engine == null) throw new IllegalStateException("JRuby engine missing; add jruby-complete to classpath");

Try / catch

try {
    plugin = rubyStrategy.run(file);
} catch (Exception e) {
    if (e.getMessage().contains("Cannot find jRuby script engine")) {
        // prompt to install JRuby or disable Ruby plugins
    } else throw e;
}

Prevention

When it happens

Trigger: Launching a .rb plugin when JRuby (jruby-complete or the jruby ScriptEngineFactory) is not on the classpath, leaving getEngineByName("jruby") null.

Common situations: JRuby jar missing from the distribution; shaded jar stripped META-INF/services/javax.script.ScriptEngineFactory; JRuby version whose registered engine names no longer include "jruby"; JDK incompatibility with the bundled JRuby.

Related errors


AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05). Data as JSON: /api/errors/4e3c315000bfd392. Report an issue: GitHub.