How to use Java in Flatpak VSCodium [TUTORIAL]
from serpent0763@lemmy.ml to linux@lemmy.ml on 19 Apr 18:23
https://lemmy.ml/post/28855715

After hours of trying understand how to set up VSCodium with Java extension, i found a solution so here it is, idiotproof (i hope) tutorial for future me and others like me ;)

Flatpak VSCodium with java extension

Via Terminal

  1. Install VSCodium:
flatpak install com.vscodium.codium
  1. Install “Extension Pack for Java” extension for VSCodium:
flatpak run com.vscodium.codium --install-extension vscjava.vscode-java-pack
  1. Install flatpak openjdk extension. (In this case openjdk21):
flatpak install flathub org.freedesktop.Sdk.Extension.openjdk21
  1. Add two new environment to use flatpak openjdk extension in VSCodium:
flatpak override --user --env=JAVA_HOME=/usr/lib/sdk/openjdk21 com.vscodium.codium && flatpak override --user --env=PATH=/usr/lib/sdk/openjdk21/bin:/app/bin:/usr/bin com.vscodium.codium
  1. Restart VSCodium:
flatpak kill com.vscodium.codium && flatpak run com.vscodium.codium
  1. Done.

Via Graphical interface

  1. Install “VSCodium”:
    1. Go to app store and search for “VSCodium”.
    2. Make sure it’s flatpak versionn.
    3. Click Install button and after downloading open the app.
  2. Install “Extension Pack for Java” extension in VSCodium:
    1. Go to Extensions pannel (on the left).
    2. Search for “Extension Pack for Java”.
    3. Click Install button.
    4. Close “VSCodium”.
  3. Install flatpak openjdk extension. (In this case openjdk21):
    1. Search for “Terminal” app and open it.
    2. Paste command below:
flatpak install flathub org.freedesktop.Sdk.Extension.openjdk21
3. Click `Enter`.
4. Close "Terminal".
  1. Install “Flatseal”:
    1. Go to app store and search for “Flatseal”.
    2. Click Install button and after downloading open the app.
  2. Allow VSCodium to use flatpak openjdk extension:
    1. Search for “VSCodium” in Flatseal.
    2. Go to Environment.
    3. Click + button (to the right from Variables) and paste:
PATH=/usr/lib/sdk/openjdk21/bin:/app/bin:/usr/bin
4. Click `+` once again and paste:
JAVA_HOME=/usr/lib/sdk/openjdk21
  1. Restart VSCodium

PS

There is formatting issue with markdown but it’s on lemmy side i think

#linux

threaded - newest

HumanPerson@sh.itjust.works on 19 Apr 19:35 next collapse

I’m saving this post. I’ve managed it in the past but even then I never knew how.

[deleted] on 19 Apr 20:54 next collapse

.

jokro@feddit.org on 19 Apr 21:27 next collapse

I wonder isn’t there a step missing where the flatpak extension org.freedesktop.Sdk.Extension.openjdk21 is added to the specific vscodium flatpak? Or does it add all installed sdk files automatically to the apps environment?

serpent0763@lemmy.ml on 21 Apr 22:01 collapse

I have no f idea lol, but would love to know too :)

pmk@lemmy.sdf.org on 19 Apr 22:03 next collapse

Ugh, I’ve been down the same rabbit hole, but gave up and just downloaded the jdk to my home directory and set the java path in vscodium to point to it. Same with maven.

OmegaLemmy@discuss.online on 19 Apr 23:31 collapse

probably the actual sane solution btw

that_leaflet@lemmy.world on 20 Apr 00:40 collapse

This is overly complicated. Just install Java then run

flatpak --user override --env="FLATPAK_ENABLE_SDK_EXT=openjdk" com.vscodium.codium

Note this works for all other SDKs too. It works especially well for programming languages like Rust that have their own package manager.

Doesn’t work so well for languages like C/C++ where you use your distro package manager to install dependencies. In those cases it’s easier to install VSCodium inside a container where you do have access to a distro package manager.

serpent0763@lemmy.ml on 21 Apr 21:58 collapse

Note that I could write it with 2 commands too, but I wanted it to be as ease as possible because who knows if I will remember what I meant