You are not logged in.

#1 2016-05-28 08:46:02

Eisimoor
Member
Registered: 2016-04-25
Posts: 27

[Solved] Where JAVA_HOME should point to?

I have java installed. However, JAVA_HOME is empty and I can't find out where it should point to:

$ ls /usr/lib/jvm/default-java
ls: cannot access '/usr/lib/jvm/default-java': No such file or directory

$ ls /usr/bin/java
/usr/bin/java

Last edited by Eisimoor (2016-05-31 01:39:08)

Offline

#2 2016-05-28 10:15:26

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: [Solved] Where JAVA_HOME should point to?

JAVA_HOME shouldn't point to anywhere, it shouldn't even be set.

See https://wiki.archlinux.org/index.php/Java


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

#3 2016-05-30 22:07:28

ackalker
Member
Registered: 2012-11-27
Posts: 201

Re: [Solved] Where JAVA_HOME should point to?

@WorMzy
There is no reference to JAVA_HOME anywhere in the Wiki page you linked to, let alone any advice not to use it.
On the contrary, there are (still) projects around which rely on it being set. It all depends on the specific requirements of the projects involved.
An example is java-gnome, which ironically has Arch Linux specific code in its configure script which relies on JAVA_HOME being set, although it may be possible to specify settings manually (I'm still looking for a combination which actually works).
Users of binary-only Java apps such as IDEs and other tools may not be so lucky.

EDIT: Things have changed upstream (although the latest stable version still relies on JAVA_HOME), but that doesn't invalidate my point.

Last edited by ackalker (2016-05-30 22:39:08)

Offline

#4 2016-05-30 22:52:00

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: [Solved] Where JAVA_HOME should point to?

*shrugs*

It mentions it here: https://wiki.archlinux.org/index.php/Ja … Arch_Linux

If the program is meant to be run by the user, write a custom shell script that runs the main jar file. This script should be placed in /usr/bin. Libraries generally do not require shell scripts. Write the shell script from scratch, rather than using one that is bundled with the program. Remove code that tests for custom environments (like Cygwin), and code that tries to determine if JAVA_HOME has been set (Arch does not use JAVA_HOME, it uses archlinux-java to set the /usr/bin/java symlink).

Make of that what you will.


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

#5 2016-05-30 22:54:29

ackalker
Member
Registered: 2012-11-27
Posts: 201

Re: [Solved] Where JAVA_HOME should point to?

In my case, I was able to get java-gnome's configure script to work by running either:

$ ./configure jdk=/usr/lib/jvm/default

or

$ JAVA_HOME=/usr/lib/jvm/default ./configure

(This also took care of finding jni.h, which oddly isn't symlinked from /usr/include in a way similar to the /usr/bin/java* symlinks).

In any case, I think it is a good idea to set JAVA_HOME on a case-by-case basis, using a wrapper script if need be, to prevent unexpected behaviour.

Last edited by ackalker (2016-05-30 22:55:37)

Offline

#6 2016-05-31 01:38:52

Eisimoor
Member
Registered: 2016-04-25
Posts: 27

Re: [Solved] Where JAVA_HOME should point to?

Thank you.

Offline

#7 2016-05-31 01:40:12

Eisimoor
Member
Registered: 2016-04-25
Posts: 27

Re: [Solved] Where JAVA_HOME should point to?

WorMzy wrote:

JAVA_HOME shouldn't point to anywhere, it shouldn't even be set.

See https://wiki.archlinux.org/index.php/Java

One of the app I have requires it.

Offline

Board footer

Powered by FluxBB