Java: Difference between revisions
it is important that this path is written like this because this extension relies on other directories besides `bin/` to configure the jdt language server. without this path, the language server erroneously fails and displays confusing errors. |
m update links |
||
| Line 1: | Line 1: | ||
This article is about [ | This article is about [[Wikipedia:Java (programming language)|Java]], the programming language. | ||
__TOC__ | __TOC__ | ||
| Line 9: | Line 9: | ||
== JDK options == | == JDK options == | ||
Your default choice should probably be to install <code>jdk</code>, which is an alias to the latest [ | Your default choice should probably be to install <code>jdk</code>, which is an alias to the latest [[Wikipedia:Long-term support|LTS]]. If you're in a server environment, go for <code>jdk21_headless</code>. Java 21 is the currently-maintained LTS version of OpenJDK as of April 2024. | ||
As you might expect, though, many flavors of Java are available in NixOS. | As you might expect, though, many flavors of Java are available in NixOS. | ||
| Line 24: | Line 24: | ||
== VSCode + Language Support for Java (TM) by Red Hat extension == | == VSCode + Language Support for Java (TM) by Red Hat extension == | ||
Unfortunately the extension contains and uses a version of the JRE which makes use of dynamically loaded libraries, which nix cannot accomodate out-of-the-box. Fortunately there's a simple solution in the use of [https://github.com/ | Unfortunately the extension contains and uses a version of the JRE which makes use of dynamically loaded libraries, which nix cannot accomodate out-of-the-box. Fortunately there's a simple solution in the use of [https://github.com/nix-community/nix-ld nix-ld]. Here's a simple <code>flake.nix</code> snippet to get you started (I'll focus on the <code>devShell</code> part for brevity): | ||
<syntaxhighlight lang="nix" line highlight="6,10" copy> | <syntaxhighlight lang="nix" line highlight="6,10" copy> | ||
| Line 114: | Line 114: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
More options can be found in the [https://wiki.archlinux.org/ | More options can be found in the [https://wiki.archlinux.org/title/Java_Runtime_Environment_fonts ArchWiki] | ||
== Overriding java jks Certificate Store == | == Overriding java jks Certificate Store == | ||