eclipse-vertx/vert.x · error · RuntimeException

Unable to detect java compiler, make sure you're using a JDK

Error message

Unable to detect java compiler, make sure you're using a JDK not a JRE!

What it means

Environment capability check in CompilingClassLoader: ToolProvider.getSystemJavaCompiler() returned null, meaning the runtime is a JRE without the javac compiler. Dynamic compilation of .java verticle sources is impossible in this environment.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/impl/verticle/CompilingClassLoader.java:61

  public CompilingClassLoader(ClassLoader loader, String sourceName) {
    super(loader);
    URL resource = getResource(sourceName);
    if (resource == null) {
      throw new RuntimeException("Resource not found: " + sourceName);
    }
    //Need to urldecode it too, since bug in JDK URL class which does not url decode it, so if it contains spaces you are screwed
    final File sourceFile = new File(decodeURIComponent(resource.getFile(), false));
    if (!sourceFile.canRead()) {
      throw new RuntimeException("File not found: " + sourceFile.getAbsolutePath() + " current dir is: " + new File(".").getAbsolutePath());
    }

    this.javaSourceContext = new JavaSourceContext(sourceFile);

    try {
      DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
      JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
      if (javaCompiler == null) {
        throw new RuntimeException("Unable to detect java compiler, make sure you're using a JDK not a JRE!");
      }
      StandardJavaFileManager standardFileManager = javaCompiler.getStandardFileManager(null, null, null);

      standardFileManager.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(javaSourceContext.getSourceRoot()));
      fileManager = new MemoryFileManager(loader, standardFileManager);

      // TODO - this needs to be fixed so it can compile classes from the classpath otherwise can't include
      // other .java resources from other modules

      JavaFileObject javaFile = standardFileManager.getJavaFileForInput(StandardLocation.SOURCE_PATH, resolveMainClassName(), Kind.SOURCE);
      JavaCompiler.CompilationTask task = javaCompiler.getTask(null, fileManager, diagnostics, null, null, Collections.singleton(javaFile));
      boolean valid = task.call();
      if (valid) {
        for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
          String code = d.getCode();
          if (code == null || (!code.startsWith("compiler.warn.annotation.method.not.found") &&
              !"compiler.warn.proc.processor.incompatible.source.version".equals(code))) {
            log.info(d);

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Run on a JDK instead of a JRE
  2. Pre-compile the verticle to bytecode and deploy the compiled class instead
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/impl/verticle/CompilingClassLoader.java:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/4e593ae40a3df883. Report an issue: GitHub.