Konloch/bytecode-viewer · error · Exception

Cannot find Jython script engine! Please contact Konloch.

Error message

Cannot find Jython script engine! Please contact Konloch.

What it means

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.

Source

Thrown at src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.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 PythonPluginLaunchStrategy implements PluginLaunchStrategy
{

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

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

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

        return (Plugin) engine.eval(file.getName().replace(".py", "").replace(".python", "") + "()");
    }
}

View on GitHub (pinned to 31430e0033)

Solutions

  1. Add the Jython standalone jar (org.python:jython-standalone) to the classpath so its ScriptEngineFactory registers under "python"
  2. Check registered engines with new ScriptEngineManager().getEngineFactories() and confirm the "python" name is present
  3. Rebuild/re-extract the BCV distribution so service-provider files are intact
  4. If Jython is incompatible with your JDK, run on an older Java version supported by Jython

Example fix

// before (pom.xml, missing engine)
<!-- no jython dependency -->
// after
<dependency>
  <groupId>org.python</groupId>
  <artifactId>jython-standalone</artifactId>
  <version>2.7.3</version>
</dependency>
Defensive patterns

Strategy: fallback

Validate before calling

ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
if (engine == null) throw new IllegalStateException("Jython engine missing; add jython-standalone to classpath");

Try / catch

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

Prevention

When it happens

Trigger: Launching a .py plugin when Jython (or its ScriptEngineFactory service registration) is absent from the classpath, so getEngineByName("python") resolves to null.

Common situations: 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.

Related errors


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