You are not logged in.

#1 2023-12-22 09:48:23

diederick76
Member
Registered: 2010-02-14
Posts: 169

[SOLVED] Groovy can't find javac

When I start groovy, it fails after:

which: no javac in (/home/diederick/.gem/ruby/3.0.0/bin:/home/diederick/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/home/diederick/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
groovy: JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME.

Indeed,

$ env | grep JAVA_HOME

comes up empty.

However:

$ pacman -Qo javac
/usr/bin/javac is eigendom van java-environment-common 3-5

I installed java using archlinux-java.

$ archlinux-java status
Available Java environments:
  java-11-openjdk
  java-17-openjdk (default)
  java-21-openjdk
  java-7-openjdk/jre
  java-8-openjdk/jre

I could I set JAVA_HOME to whatever is the current environment, but then it wouldn't change when setting another. So, how do I correctly tell groovy where it will find the java compiler?

Last edited by diederick76 (2023-12-23 07:15:01)

Offline

#2 2023-12-22 23:06:07

ponyrider
Member
Registered: 2014-11-18
Posts: 112

Re: [SOLVED] Groovy can't find javac

archlinux-java always points to /usr/lib/jvm/default/bin. Apparently groovy doesn't know about this, and has no way of checking (multiplatform). Therefore DO set $JAVA_HOME to the aforementioned path and you can continue to use archlinux-java as intended

Offline

#3 2023-12-23 07:14:36

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: [SOLVED] Groovy can't find javac

Thanks. There was something odd with java 17. Its bin directory did not contain javac, which was why groovy couldn't find it. Reinstalling jdk17-openjdk fixed this.

Offline

Board footer

Powered by FluxBB