1

I want use .bash_profile but I have a bug.

In my file I have :

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

But When my JAVA_HOME is called by Ionic I have :

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home

I don't know why my JAVA_HOME is not same.

I try to launch . .bash_profile but don't work

4
  • you should try 'source .bash_profile' The file is probably not executable. Or open a new terminal window. – Natsfan Dec 14 '18 at 15:29
  • 2
    @jmh the dot is the same as source – Allan Dec 14 '18 at 15:46
  • Can you post the contents of your ~/.bash_profile please. Also, start a new session and post the output of echo $JAVA_HOME – Allan Dec 14 '18 at 15:47
  • i put an echo statement in all my profiles, so that I know which ones have run. – historystamp Dec 16 '18 at 5:34
2

Per memory in the .bash_profile when I used to dabble in Java you need to add export and ". In the Terminal run the command:

 nano .bash_profile

Then add:

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home"

Then do the reboot of: . .bash_profile after you've saved the bash_profile

0
1

Bash uses its various rc files differently depending on how it's invoked. Read the INVOCATION section of the bash man page for the specifics but briefly for a login shell it will read bash_profile (along with other things), and for a non-login shell, it will read bashrc (along with other things). Most people will source bashrc from their bash_profile and do everything else in bashrc.

You don't show it, but presumably you're not export-ing JAVA_HOME. You should. You want to make sure that goes to the parent shell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .