0

I have installed java 1.7 on my mac, and I have edited ~/.bash_profile as the following:

export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Content    s/Home
export PATH=${JAVA_HOME}/bin:$PATH

When I execute source /.bash_profile, the java become available. But when I restart the shell, I got the following error message:

No Java runtime present, requesting install.

I have to re-execute source /.bash_profile to make it available.

I am so confused, hope someone can help me.

lina
  • 1
  • 4

2 Answers2

1

It is because variables you export are only valid in the current ssh session.

Look here for deeper explanation:

Mac OS X 10.9 - setting permanent environment variables

As @trojanfoe stated there:

The .bash_profile is only executed for a login-shell, whereas .bashrc is executed for every new shell instance

Community
  • 1
  • 1
pnadczuk
  • 907
  • 1
  • 7
  • 12
  • After I used **.bashrc**, it didn't resolve. I think it's because I installed JRE, NOT JDK. After I install a jdk version, it can work well. Thanks anyway. – lina Jun 23 '15 at 07:45
0

Check this posting out please. I don't believe your problem is a JAVA problem but it looks rather misunderstanding on BASH side.

Community
  • 1
  • 1
Alp
  • 3,027
  • 1
  • 13
  • 28