Installing java jdk19 not working (bash javac: command not found)

I’ve tried installing java on my laptop so I can code. Everytime I try to compile a .java file it says
bash javac: command not found
Following a guide online I tried putting in this command to install the JDK

sudo pacman -S jre-openjdk-headless jre-openjdk jdk-openjdk openjdk-doc openjdk-src

After loading and doing nothing for a couple minutes it shoots out many errors, all along the lines of

error: failed retrieving file 'openjdk8-src-8.362.u09-1-x86_64.pkg.tar.zst' from : The requested URL returned error: 404

The result of java -version is

openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7)
OpenJDK 64-Bit Server VM (build 19.0.2+7, mixed mode)

When I enter which javac it spits out

which: no javac in (/home/matthew/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin)

And when I enter echo $PATH is says


If you need any other information, please let me know!

Welcome to the forum! :wave:

archlinux-java status should look like this:

Available Java environments:
  java-19-openjdk (default)

If it is not default, set it:

sudo archlinux-java set java-19-openjdk

See Java - ArchWiki

It appears your mirror list is out of date. See Pacman-mirrors - Manjaro

The output of archlinux-java status is

Available Java environments:
  java-19-openjdk (default)

Would fixing my mirror list solve my issue?

Yes, if the packages were not successfully installed because of it.

Thank you, I will try this when I get back to my computer.

The mirror list was the issue! I updated my mirror list then re-ran the initial command to install the jdk and it now works perfect! Thank you so much!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.