Module path in in-memory mode

When to use this

You run modules in-memory (same process) and Hypertube needs to locate the hosted DLL, JAR, or package path — especially in polyglot setups (Quick Start #4).

Prerequisites

See In-memory vs remote cookbook for execution-mode diagram:

In-memory, polyglot in-memory, and remote execution modes


How it works

When GraftConfig.host is unset, generated GraftConfig.init():

  1. Creates a runtime-specific graft root folder under the application
  2. Unpacks or locates module artifacts for the target runtime
  3. Passes the resolved module path to Hypertube's modules configuration
  4. Starts the embedded runtime with that path

You normally do not set module paths manually — the generated Graft handles resolution from package contents.


When you must configure paths

JVM / Java

For in-memory Java modules, the JAR must be on the classpath. Generated GraftConfig validates classpath and throws a clear error if the module JAR is missing:

Run application with module jar on startup classpath

Fix: ensure the module JAR is referenced in your build or pass JVM classpath flags as required by your graft's generated init logic.

Custom module location

Use config files when generated defaults are insufficient:

graftcode-config.json:

{
  "modules": "/path/to/hosted/module.jar"
}

Exact key names follow the Graft connection string Modules segment when full connection strings are supported.

Remote mode

When host points to a remote GG, module paths are resolved on the Gateway via --modules — not in the caller. See Hosting multiple modules.


Polyglot in one process

Quick Start #4 demonstrates calling a foreign-language module in-process. Each Graft's GraftConfig initializes its runtime slice independently.


Verify it works

  • GraftConfig.init() completes without IllegalStateException / path errors
  • Method calls reach the hosted module (not empty stubs)

Common mistakes

MistakeFix
Java: JAR not on classpathAdd JAR to project dependencies or JVM args
Setting module path for remote GraftsConfigure --modules on GG instead
Wrong working directoryRun app from directory where config files are found

See also

Practiced in Quick Start tutorial #4