Bug 1107342 - JAVA_HOME incorrectly set by /etc/profile.d/alljava.*
Summary: JAVA_HOME incorrectly set by /etc/profile.d/alljava.*
Status: IN_PROGRESS
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Java (show other bugs)
Version: Current
Hardware: x86-64 Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 1043388
  Show dependency treegraph
 
Reported: 2018-09-05 18:46 UTC by Mario Pavlov
Modified: 2024-03-13 17:27 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Patches for both the Bourne shell and the C shell. (722 bytes, application/x-bzip)
2018-09-05 18:46 UTC, Mario Pavlov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Pavlov 2018-09-05 18:46:11 UTC
Created attachment 782101 [details]
Patches for both the Bourne shell and the C shell.

If custom java (e.g. Oracle) is installed and used via the "alternatives system" then /etc/profile.d/alljava.* wouldn't set the correct JAVA_HOME.
So the user is in a situation where they have all links pointing to their custom java but the JAVA_HOME env var is set to whatever OpenJDK was installed before that.
This causes nasty issues with all sorts of java tools and applications.

Please find attached patches that add support for determining JAVA_HOME via /etc/alternatives/java if exists.

The patches were tested with the latest Tumbleweed as of this writing.
Comment 1 Michael Pujos 2019-01-20 17:15:33 UTC
alljava scripts in /etc/profile.d do indeed not honor the current alternative set for Java, which leads to unexpected results with Java tools making use of JAVA_HOME to determine which JRE/JDK to use.
It would be great to have this fixed officially, as this is confusing.
Comment 2 Mario Pavlov 2019-01-20 18:27:20 UTC
Michael, thanks for your comment. Did you have a chance to try out the patches?
Comment 3 владимир путин 2021-07-06 18:46:36 UTC
After installing java-16-openjdk the JAVA_HOME is pointed to /usr/lib64/jvm/java
Which simply doesn't exist.
Shouldn't it point to the /usr/lib64/jvm/jre?
Comment 4 Ruediger Oertel 2023-09-18 15:50:43 UTC
Factory/TW: https://github.com/openSUSE/aaa_base/pull/133

SLE-15: created request id 307713
Comment 6 Maintenance Automation 2023-10-20 20:30:03 UTC
SUSE-RU-2023:4154-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1107342, 1215434
Sources used:
SUSE Manager Retail Branch Server 4.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Manager Server 4.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Enterprise Storage 7.1 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro 5.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro for Rancher 5.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro for Rancher 5.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro 5.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro for Rancher 5.4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro 5.4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Micro 5.5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
Basesystem Module 15-SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
Basesystem Module 15-SP5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
Development Tools Module 15-SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
Development Tools Module 15-SP5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise High Performance Computing ESPOS 15 SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise High Performance Computing LTSS 15 SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Server 15 SP3 LTSS 15-SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Linux Enterprise Server for SAP Applications 15 SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2
SUSE Manager Proxy 4.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.6.2

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 11 Maintenance Automation 2024-02-02 16:30:03 UTC
SUSE-RU-2024:0322-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1107342, 1215434
Sources used:
openSUSE Leap 15.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
openSUSE Leap Micro 5.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
openSUSE Leap Micro 5.4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
openSUSE Leap 15.5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro for Rancher 5.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro 5.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro for Rancher 5.4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro 5.4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro 5.5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
Basesystem Module 15-SP5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
Development Tools Module 15-SP5 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise High Performance Computing ESPOS 15 SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Desktop 15 SP4 LTSS 15-SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Server 15 SP3 LTSS 15-SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Server 15 SP4 LTSS 15-SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Server for SAP Applications 15 SP3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Server for SAP Applications 15 SP4 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Manager Proxy 4.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Manager Retail Branch Server 4.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Manager Server 4.3 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Enterprise Storage 7.1 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro 5.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1
SUSE Linux Enterprise Micro for Rancher 5.2 (src): aaa_base-84.87+git20180409.04c9dae-150300.10.9.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.