Java: Difference between revisions

Frontear (talk | contribs)
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.
DHCP (talk | contribs)
m update links
Line 1: Line 1:
This article is about [https://en.wikipedia.org/wiki/Java_(programming_language) Java], the programming language.
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 [https://en.wikipedia.org/wiki/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.
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/Mic92/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):
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/index.php/Java_Runtime_Environment_fonts archlinux wiki]
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 ==