SUSE Support

Here When You Need Us

How to configure multiple java versions for different local users

This document (000021129) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12

Situation

The command java -version does not report an accurate value for $PATH.

Resolution

Follow these steps to set the proper path of the intended java version for a specific local user.

1. Use the following command to check the current java versions available in the system:
# sudo rpm -qa | grep java
2. To identify the path for the intended java version in the system, use the following command, replacing the java version determined in step 1:
# rpm -ql <java_version_xxxxx>
3. Log in as the user "local user" (eg. testlocal):
# vi /home/testlocal/.bashrc
4. Add the following lines to the .bashrc file, using the path determined above in step 2, then save the changes and exit:
export JAVA_HOME=<path_for_java_version_xxxxx>
export PATH=$JAVA_HOME/bin:$PATH
5. To reflect the changes:
# source /home/testlocal/.bashrc


Running java -version should now return the correct information.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021129
  • Creation Date: 05-Jul-2023
  • Modified Date:19-Jul-2023
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Server for SAP Applications

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.