Module java.sql not found
I tried to install this language server using Mason with JDK 19. When I did this the link_linux.sh script failed with "module java.sql not found". I upgraded to JDK 20 and that fixed the problem.
https://www.oracle.com/java/technologies/javase/jdk20-archive-downloads.html
Same problem happening for me but for JDK17
Getting the same problem with OpenJDK 17 and OpenJDK 20, this is the error:
Failed
◍ java-language-server
▼ Displaying full log
Cloning into '.'...
From https://github.com/georgewfraser/java-language-server
* tag v0.2.39 -> FETCH_HEAD
+ ./scripts/link_linux.sh
Error: Module java.sql not found
java.lang.module.FindException: Module java.sql not found
at java.base/java.lang.module.Resolver.findFail(Resolver.java:893)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:129)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:421)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:255)
at jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:536)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:424)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:276)
at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:55)
at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:33)
spawn: bash failed with exit code 1 and signal 0.
but the module seems to be there:
java --list-modules | grep java.sql@
[email protected]
I'm running the latest (java 20) and getting the same error.
You have to install e.g. openjdk17-jmods (on Void Linux) or search for similar Java Modules package on your distribution.
Can confirm installing jmods fixes the issue with JDK 20 as well.
Can also confirm on Fedora 39, installing java-17-openjdk-jmods fixed the issue.
I installed jmods for openjdk-latest, but that did not solve the issue. Installing jdk 17 + jmods did not solve the issue either. On Fedora 40 (Linux 6.9.5-200.fc40.x86_64) if that matters. Already have maven installed also.
I installed jmods for openjdk-latest, but that did not solve the issue. Installing jdk 17 + jmods did not solve the issue either. On Fedora 40 (Linux 6.9.5-200.fc40.x86_64) if that matters. Already have maven installed also.
Check your JAVA_HOME is correct by cat link_linux.sh. If not, to find it by ls -l /usr/lib/jvm, and check if your java-xx... has jmods directory. If not, then install the corresponding jmods by sudo dnf install java-21-openjdk-jmods.
E.g.,
cat link_linux.sh
#!/usr/bin/env bash
# Create self-contained copy of java in dist/linux
set -e
# Set env variables to build with mac toolchain but linux target
JAVA_HOME="/usr/lib/jvm/java-21-openjdk-21.0.4.0.7-2.fc40.x86_64"
# Build in dist/linux
rm -rf dist/linux
jlink \
--module-path $JAVA_HOME/jmods \
--add-modules java.base,java.compiler,java.logging,java.sql,java.xml,jdk.compiler,jdk.jdi,jdk.unsupported,jdk.zipfs \
--output dist/linux \
--no-header-files \
--no-man-pages \
--compress 2
ls -l /usr/lib/jvm/java-21-openjdk-21.0.4.0.7-2.fc40.x86_64/jmods