Skip to content

Java ​

Catalog v8.

Installs a headless OpenJDK and the jdtls language server.

Select ​

toml
[toolchains]
java = "21"

Choose the line in the [toolchains] table of limanix.toml and apply the change. Add Maven or Gradle in the same table to build projects.

Versions ​

ValueJDKNotes
25OpenJDK 25.x
21OpenJDK 21.xRecommended
17OpenJDK 17.x

Lines come from the base Nixpkgs revision and receive its updates with each catalog release. The JDK is headless: it leaves out the graphical libraries, which a VM without a display does not use.

Use ​

Inside the VM, compile and run a class:

console
javac Main.java
java Main

Run jshell to try code interactively. JAVA_HOME points to the selected JDK in every session.

Other tools and JDKs ​

The selected JDK is also at /usr/lib/jvm/openjdk-<line>, where Gradle, IntelliJ IDEA and VS Code look for installed JDKs. When a project asks for another Java version, Gradle or the IDE downloads a generic Linux JDK, which runs with nix-ld, on in every LimaNix VM.

Editor support ​

The module installs jdtls for editors that support the Language Server Protocol; AstroNvim starts it for Java files. jdtls runs on its own JDK from Nixpkgs, independent of the selected line, and loads Lombok: the editor understands code that uses Lombok annotations.

Configuration and integration
BoundaryContract
Public capabilitylmx.capabilities.jdk.package, the newest selected JDK; lmx.capabilities.languageSupport.tools.jdtls; Java parser
SettingsJAVA_HOME; /usr/lib/jvm/openjdk-<line> for every selected line
IntegrationMaven, Gradle and Quarkus run on the JDK of the capability
ServicesNo daemon

Corner cases ​

CaseBehavior or next step
A downloaded JDK does not startCheck that programs.nix-ld.enable is on, or select that Java line
A desktop Java program needs a displayThe headless JDK cannot open windows; run the program on the Mac

Free and open source under the Apache License 2.0.