How to set the JAVA_HOME environment variable?
Environment
- Red Hat Enterprise Linux
- OpenJDK
Issue
- To run JBoss product, I need to set the
JAVA_HOMEenvironment variable, how to set it? - How do I set the
JAVA_HOMEenvironment variable?
Resolution
Generally JAVA_HOME is needed to run the java related applications, else the results may vary. You will need to set the JAVA_HOME environment variable:
- Determine the correct value for JAVA_HOME. The JAVA_HOME should point to the directory containing a bin/java executable.
- As the user who will use OpenJDK, open the shell configuration file. For the Bash shell, this file is /home/username/.bashrc.
- At the bottom of the file, type the following line, replacing the hypothetical path with the actual path to use on your own system:
export JAVA_HOME="/path/to/java/home" - Save the file, and log out of and back into your session.
For detailed instructions, please see JBOSS Enterprise Application Platform Installation Guide: Install OpenJDK on Red Hat Enterprise Linux
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
