Open jimothyclark opened 5 years ago
Also you can use this if running on ubuntu and setting up the directory for maven. (check your respective version of jdk)
if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME M2_HOME=/usr/share/maven M2=$M2_HOME/bin PATH=$PATH:$M2_HOME:$M2
mesg n 2> /dev/null || true
I am VERY new to all of this, but I am humble enough to admit that I am a novice and I am coachable enough to learn from anyone! I have researched a couple best practices to avoid stepping on anyone's toes, but I am happy to learn ways my use of this site could improve.
I am learning Linux and I am trying to do configure Java_Home on my Linux. So far, I have barely done more than install a few virtual machines (CentOS 7 and two clones; CentOS7 Full DVD and CentOS 7 NetInstall).
My Jenkins course on stackskills.com referred me to GitHub with my questions and I'm having trouble with the following instructions on how to add Java_Home to my startup script:
Configure Java_Home on Linux: Login to your account and open the startup script file which is usually ~/.bash_profile file (or can be .bashrc depending on your envrionment settings) $ vi ~/.bash_profile
In the startup script, set JAVA_HOME and PATH
C shell:
setenv JAVA_HOME jdk-install-dir setenv PATH $JAVA_HOME/bin:$PATH export PATH=$JAVA_HOME/bin:$PATH jdk-install-dir is the JDK installation director, which should be something similar to /usr/java/jdk1.5.0_07/bin/java
Bourne shell:
JAVA_HOME=jdk-install-dir export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH Korn and bash shells:
export JAVA_HOME=jdk-install-dir export PATH=$JAVA_HOME/bin:$PATH Type the following command to activate the new path settings immediately:
$ source ~/.bash_profile
Verify new settings:
$ echo $JAVA_HOME
$ echo $PATH
I'm not exactly sure how to use these instructions. Below is a screenshot of my VM and, from the formatting, it looks like I have the Bourne shell.
Please advise...