You are not logged in.

#1 2024-10-03 06:56:21

dedpul
Member
Registered: 2016-07-25
Posts: 15

running Scala REPL: JAVA_HOME is not set correctly

I tried many things, idk where to begin troubleshoot

❯ java -version
openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment (build 22.0.2+9)
OpenJDK 64-Bit Server VM (build 22.0.2+9, mixed mode, sharing)
❯ scala
Error: JAVA_HOME is not defined correctly.
  We cannot execute /home/tarun/.cache/coursier/arc/https/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.24%252B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.24_8.tar.gz/jdk-11.0.24+8/bin/java

it was running just fine a few days ago
Any help is appreciated

Last edited by dedpul (2024-10-03 07:00:48)

Offline

#2 2024-10-03 10:10:48

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,926

Re: running Scala REPL: JAVA_HOME is not set correctly

Java on archlinux doesn't use JAVA_HOME, unless you set it yourself somewhere it will be empty .

Please post the output of archlinux-java status .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-10-03 11:26:02

dedpul
Member
Registered: 2016-07-25
Posts: 15

Re: running Scala REPL: JAVA_HOME is not set correctly

Lone_Wolf wrote:

Java on archlinux doesn't use JAVA_HOME, unless you set it yourself somewhere it will be empty .

Please post the output of archlinux-java status .

I've tried all

❯ archlinux-java status
Available Java environments:
  java-11-openjdk
  java-17-openjdk
  java-21-openjdk
  java-22-openjdk (default)

Offline

#4 2024-10-04 09:37:55

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,926

Re: running Scala REPL: JAVA_HOME is not set correctly

Ok, the error suggests scala is looking specifically for java 11 .
Let's try to "teach" scala to find java 11.

Please create a script with

#!/bin/sh

export PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH"
exec /path/to/application "$@"

as content .
If that fails also, try adding

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk

before the exec .

https://wiki.archlinux.org/title/Java#L … va_version


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2024-10-04 09:46:03

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,402
Website

Re: running Scala REPL: JAVA_HOME is not set correctly

Mod note: Moving to AUR Issues.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2024-10-04 10:51:01

dedpul
Member
Registered: 2016-07-25
Posts: 15

Re: running Scala REPL: JAVA_HOME is not set correctly

Lone_Wolf wrote:

Ok, the error suggests scala is looking specifically for java 11 .
Let's try to "teach" scala to find java 11.

Please create a script with

#!/bin/sh

export PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH"
exec /path/to/application "$@"

as content .
If that fails also, try adding

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk

before the exec .

https://wiki.archlinux.org/title/Java#L … va_version

funnily enough adding JAVA_HOME like that works.
kill me now

Offline

#7 2024-10-05 11:46:37

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,926

Re: running Scala REPL: JAVA_HOME is not set correctly

Glad I could help,

Please prepend [Solved] to the thread title (edit first post)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2024-10-05 16:03:24

dedpul
Member
Registered: 2016-07-25
Posts: 15

Re: running Scala REPL: JAVA_HOME is not set correctly

Lone_Wolf wrote:

Glad I could help,

Please prepend [Solved] to the thread title (edit first post)

but if arch doesnt use it, why do i need to set it?
why did this happen anyway? I installed it using the instructions on Scala's official site.

and now sbt is broken too...

Offline

#9 2024-10-05 16:51:06

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,926

Re: running Scala REPL: JAVA_HOME is not set correctly

Multi-platform applications targeting linux often make assumptions about the setup they encounter.
Typically they (try to) support .deb & rpm installs.

Archlinux does things differently and adjustments are often necessary to get things to run.

I have no idea what went wrong on your scala install, but there is a wiki page for scala and an aur package that is actively maintained.

See https://wiki.archlinux.org/title/Scala

If you're unfamiliar with AUR, read https://wiki.archlinux.org/title/Arch_User_Repository.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB