{"record":{"id":"8c24e102f988a8e5","repo":"Konloch/bytecode-viewer","slug":"cannot-find-jython-script-engine-please-contact-k","errorCode":null,"errorMessage":"Cannot find Jython script engine! Please contact Konloch.","messagePattern":"Cannot find Jython script engine! Please contact Konloch\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.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 PythonPluginLaunchStrategy 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(\"python\");\n\n        if (engine == null)\n            throw new Exception(\"Cannot find Jython 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(\".py\", \"\").replace(\".python\", \"\") + \"()\");\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/PythonPluginLaunchStrategy.java#L27-L53","documentation":"Thrown by PythonPluginLaunchStrategy.run when ScriptEngineManager.getEngineByName(\"python\") returns null, meaning the Jython script engine is not registered on the classpath. BCV cannot evaluate the Python plugin file, so it fails fast with a contact-the-author message. It signals a missing/incorrectly packaged Jython dependency rather than a script bug.","triggerScenarios":"Launching a .py plugin when Jython (or its ScriptEngineFactory service registration) is absent from the classpath, so getEngineByName(\"python\") resolves to null.","commonSituations":"Jython jar removed from the distribution or shaded jar dropped META-INF/services entries; using Jython versions where the engine name differs (e.g. needing \"jython\" instead of \"python\"); running under a JVM/language level unsupported by the bundled Jython.","solutions":["Add the Jython standalone jar (org.python:jython-standalone) to the classpath so its ScriptEngineFactory registers under \"python\"","Check registered engines with new ScriptEngineManager().getEngineFactories() and confirm the \"python\" name is present","Rebuild/re-extract the BCV distribution so service-provider files are intact","If Jython is incompatible with your JDK, run on an older Java version supported by Jython"],"exampleFix":"// before (pom.xml, missing engine)\n<!-- no jython dependency -->\n// after\n<dependency>\n  <groupId>org.python</groupId>\n  <artifactId>jython-standalone</artifactId>\n  <version>2.7.3</version>\n</dependency>","handlingStrategy":"fallback","validationCode":"ScriptEngine engine = new ScriptEngineManager().getEngineByName(\"python\");\nif (engine == null) throw new IllegalStateException(\"Jython engine missing; add jython-standalone to classpath\");","typeGuard":null,"tryCatchPattern":"try {\n    plugin = pythonStrategy.run(file);\n} catch (Exception e) {\n    if (e.getMessage().contains(\"Cannot find Jython script engine\")) {\n        // prompt to install Jython or disable Python plugins\n    } else throw e;\n}","preventionTips":["Include org.python:jython-standalone in the deployment","Verify engine factories at startup with getEngineFactories()","Avoid excluding META-INF/services in shading/miniﬁcation","Match Jython version to your JDK"],"tags":["java","jython","python","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"}