Skip to content

Instantly share code, notes, and snippets.

@fernandor777
Last active November 10, 2020 17:04
Show Gist options
  • Save fernandor777/097e25dee99b9e300fd3aa2569cf5e4d to your computer and use it in GitHub Desktop.
Save fernandor777/097e25dee99b9e300fd3aa2569cf5e4d to your computer and use it in GitHub Desktop.
Declare java home

Option 1

vim /etc/profile.d/java.sh

#!/bin/sh
export JAVA_HOME=/tomcat/jdk
export PATH=$PATH:$JAVA_HOME/bin

Option 2

find /usr/lib/jvm/java-1.x.x-openjdk

vim /etc/profile

Prepend sudo if logged in as not-privileged user, ie. sudo vim Press 'i' to get in insert mode

add:

export JAVA_HOME="path that you found"
export PATH=$JAVA_HOME/bin:$PATH

logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment