{"record":{"id":"4e3c315000bfd392","repo":"Konloch/bytecode-viewer","slug":"cannot-find-jruby-script-engine-please-contact-ko","errorCode":null,"errorMessage":"Cannot find jRuby script engine! Please contact Konloch.","messagePattern":"Cannot find jRuby script engine! Please contact Konloch\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java","lineNumber":45,"sourceCode":"import java.io.FileReader;\nimport java.io.Reader;\n\n/**\n * @author Konloch\n * @author Bibl (don't ban me pls)\n * @since 1 Jun 2015\n */\npublic class RubyPluginLaunchStrategy implements PluginLaunchStrategy\n{\n\n    @Override\n    public Plugin run(File file) throws Throwable\n    {\n        ScriptEngineManager manager = new ScriptEngineManager();\n        ScriptEngine engine = manager.getEngineByName(\"jruby\");\n\n        if (engine == null)\n            throw new Exception(\"Cannot find jRuby script engine! Please contact Konloch.\");\n\n        Reader reader = new FileReader(file);\n        engine.eval(reader);\n\n        return (Plugin) engine.eval(file.getName().replace(\".rb\", \"\").replace(\".ruby\", \"\") + \".new\");\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":53,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java#L27-L53","documentation":"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.","triggerScenarios":"Launching a .rb plugin when JRuby (jruby-complete or the jruby ScriptEngineFactory) is not on the classpath, leaving getEngineByName(\"jruby\") null.","commonSituations":"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.","solutions":["Add org.jruby:jruby-complete (which registers the JSR-223 engine) to the classpath","Enumerate new ScriptEngineManager().getEngineFactories() to verify the \"jruby\" name is registered","Rebuild the jar without excluding META-INF/services entries","Pin a JRuby version compatible with your JDK if the engine fails to initialize"],"exampleFix":"// before (pom.xml, missing engine)\n<!-- no jruby dependency -->\n// after\n<dependency>\n  <groupId>org.jruby</groupId>\n  <artifactId>jruby-complete</artifactId>\n  <version>9.4.5.0</version>\n</dependency>","handlingStrategy":"fallback","validationCode":"ScriptEngine engine = new ScriptEngineManager().getEngineByName(\"jruby\");\nif (engine == null) throw new IllegalStateException(\"JRuby engine missing; add jruby-complete to classpath\");","typeGuard":null,"tryCatchPattern":"try {\n    plugin = rubyStrategy.run(file);\n} catch (Exception e) {\n    if (e.getMessage().contains(\"Cannot find jRuby script engine\")) {\n        // prompt to install JRuby or disable Ruby plugins\n    } else throw e;\n}","preventionTips":["Include org.jruby:jruby-complete in the deployment","Check registered engine names at startup","Preserve service-provider registration files when repackaging","Pin a JRuby release compatible with your JVM"],"tags":["java","jruby","ruby","scripting","classpath"],"backgroundTag":"missing-script-engine","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}