Setting Java_Home

Setting Java_Home

Postby laidlaws » May 25th, '25, 11:07

I have a password manager and had JAVA_HOME set. Now it has gone. What I am currently using is:
Code: Select all
JAVA_HOME=/usr/lib/jvm/jre-17-openjdk-17.0.14.0.7-1.mga9.x86_64

but it doesn't work. Probably, the string is too long.

What is the correct setting?
laidlaws
 
Posts: 282
Joined: May 24th, '11, 04:58


Re: Setting Java_Home

Postby doktor5000 » May 25th, '25, 13:32

"doesn't work" means what in particular? Also how did you have it set previously and why is it gone all of a sudden ?

BTW: there is no real length limitation for variables/strings.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18037
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Setting Java_Home

Postby laidlaws » May 25th, '25, 17:09

Thanks. "doesn't work means that the command doesnothing. Unread postby sturmvogel 's answer seems to be what I need, but I can't get a title to edit.
laidlaws
 
Posts: 282
Joined: May 24th, '11, 04:58

Re: Setting Java_Home

Postby doktor5000 » May 25th, '25, 19:19

Which command? If you mean
Code: Select all
JAVA_HOME=/usr/lib/jvm/jre-17-openjdk-17.0.14.0.7-1.mga9.x86_64

then that is expected, only thing this does is setting the environment variable JAVA_HOME to /usr/lib/jvm/jre-17-openjdk-17.0.14.0.7-1.mga9.x86_64

But afterwards you also need to run your actual java application (in the same shell session where you set the environment variable),
you didn't post any error yet what that currently looks like.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18037
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Setting Java_Home

Postby laidlaws » May 28th, '25, 20:33

Yes,, I am doing that. i am running the app after a shell prompt. A Windows user got his going by adding \bin at the end of the line, but in my installation, there is no such command.. About all that I have learned isthat JAVA_HOME will be the folder which contains /bin.

An earlier search said that I should use the path with "jre" instead of the one with "JDK" The result agrees with what I am doing anyway. But in a page I found today, a new user was advised to do the opposite.
laidlaws
 
Posts: 282
Joined: May 24th, '11, 04:58

Re: Setting Java_Home

Postby doktor5000 » May 29th, '25, 14:20

laidlaws wrote:About all that I have learned isthat JAVA_HOME will be the folder which contains /bin.

No, it's the full path to the folder which contains the actual java binary, so including /bin.

Maybe you should stop guessing, and post some actual details what java JRE/JDKs you have currently installed. As regular user:
Code: Select all
rpm -qa|grep -iE "java|jre|jdk"|sort
update-alternatives --list java
java -version
echo $JAVA_HOME
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18037
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Setting Java_Home

Postby morgano » May 30th, '25, 13:33

My invoicing program need a specific java version.
My solution is a very short luncher shell script that sets folder, and calls that java to start the app:

#!/bin/bash
/usr/lib/jvm/java-1.8*/jre/bin/java -jar fribok-2.2*.jar
cd ~/Tribun/Eko/FriBok
exit 0 # done

Then, I have a desktop icon to call that .sh shell script.
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1484
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest

cron