Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Java Embeds Python & JavaScript Runtimes Directly in JVM via Project Detroit

OpenJDK's Project Detroit uses the FFM API to embed V8 and CPython runtimes directly into the JVM, avoiding past rewrite failures like Nashorn, though native dependency challenges remain and it's not yet in standard JDK builds.

A Java developer with eight years of experience struggled for three days setting up a Python model service environment, switching between pip and conda, and finally asked why the model couldn't just run inside Java.

Project Detroit, re-proposed in OpenJDK in February and officially presented at JavaOne in March, answers that question. Its core idea: use the Foreign Function & Memory (FFM) API to embed the V8 JavaScript engine and the CPython interpreter directly into the JVM process. This is not a rewrite; it borrows the existing engines to run code.

The "not a rewrite" distinction is critical. Java previously attempted a pure-Java JavaScript engine, Nashorn, included in JDK 8. Despite initial promise, maintenance became unsustainable because the entire JavaScript ecosystem is built on V8; replicating it on the JVM meant forever chasing a moving target. Oracle's own retrospective acknowledged this as swimming upstream, and Nashorn was removed in JDK 15.

Detroit reverses that strategy. By embedding V8, JavaScript runs exactly as it does outside the JVM. Embedding CPython similarly grants access to the Python ecosystem — including AI libraries that predominantly run on CPython — theoretically making them callable from Java.

When the developer heard about Detroit, his immediate question was whether he could now call PyTorch directly from Java. The answer is cautious: Detroit remains an independent OpenJDK project, not part of the standard JDK, and has no official builds. Even if CPython is embedded, the dozens of native packages a typical model depends on may not run smoothly.

He decided to wait for JDK 28 and went back to configuring his Python environment — which, for now, is still necessary.

The article notes a parallel: around the same time, Python's toolchain was acquired by OpenAI (referring to the acquisition of the company behind key Python tooling), while Java began learning to host the Python runtime. Both languages appear to be addressing their own gaps: Python improving commercial sustainability of its toolchain, Java accepting that hosting an existing runtime is sometimes better than building from scratch.

Whether Detroit succeeds is uncertain. The Nashorn precedent looms; the new approach helps, but long-term maintenance burden will depend on the commit rhythm of the project's committers over the next year or two. The stance is to observe.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

JVMV8OpenJDKCPythonNashornFFM APIJava Python integrationProject Detroit

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion