You are not logged in.

#1 2023-05-03 18:10:30

produnis
Member
From: Germany
Registered: 2014-09-29
Posts: 50

how to use specific java version with systemd service

Hi there,
I am running airsonic (Musik Jukebox Server) for some years now.
When I set up my system, I used

java-8-openjdk/jre

as default Java. Airsonic runs just nice with it.

Now, years later, my son wants his own Minecraft Server, and I installed the mincraft-server. package. As minecraft needs a more up-to-date Java version, I installed java-20-openjdk. I did a

archlinux-java set java-20-openjdk

and Minecraft runs just fine.

My problem is, that Airsonic stopped working, and complains about the wrong java version.
I tried to edit/override the airsonic.service file with

[Service]
Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk/jre"

followed by

systemctl daemon-reload

...but Airsonic won't come up again.

If I switch back to java-8 with

archlinux-java set java-8-openjdk/jre

Airsonic will start up again, but Minecraft wont... wink

So, what else could I do in order to bind that java-8 version to airsonic?

greetings
Joe

Offline

#2 2023-05-03 18:20:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,471
Website

Re: how to use specific java version with systemd service

According to the wiki, there should be no trailing /jre in JAVA_HOME (for the systemd ENVIRONMENT setting)

Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk
# not
#Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk/jre"

Last edited by Trilby (2023-05-03 18:21:20)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-05-03 18:22:39

produnis
Member
From: Germany
Registered: 2014-09-29
Posts: 50

Re: how to use specific java version with systemd service

thx,
the folder  /usr/lib/jvm/java-8-openjdk/jre  exists, having bin/java as a subfolder...
I removed "/jre" but still the same error/problem

edit:
as the airsonic.service looks like this:

[Service]
Type=simple
Environment="JAVA_JAR=/var/lib/airsonic/airsonic.war"
Environment="JAVA_OPTS=-Xmx700m"
Environment="AIRSONIC_HOME=/var/lib/airsonic"

I added

[Service]
Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk"

## but it won't work either if I switch it to
Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk

Last edited by produnis (2023-05-03 18:26:27)

Offline

#4 2023-05-03 18:37:16

produnis
Member
From: Germany
Registered: 2014-09-29
Posts: 50

Re: how to use specific java version with systemd service

Never mind,
I got the problem:

in the airsonic.service-file, there is a hardcoded "/bin/java/"
I changed that to "/usr/lib/jvm/java-8-openjdk/jre/bin/java", and now it works....

Offline

#5 2023-05-03 20:05:51

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,255

Re: how to use specific java version with systemd service

FWIW since airsonic appears abandoned, have you considered airsonic-advanced for a more up to date - and likely also newer JRE compliant - alternative.

Offline

Board footer

Powered by FluxBB