How to set the JAVA_HOME variable in Mac OS X – Snow Leopard
2010-08-05 09:14
731 查看
Recently I had to setup a Java app on my Mac, which was running from the Terminal, and needed the JAVA_HOME variable set.
Here’s what had to be done:
- Start the Terminal app.
- Create/Edit ~/.bash_profile file.
Note: I first tried creating and using the ~/.bashrc file, but that didn’t work (Mac OS 10.6.2), while ~/.bash_profile worked as expected.
Therefore,
$ vi ~/.bash_profile
… and paste the following (make it a single line):
export JAVA_HOME=/System/Library/Frameworks/
JavaVM.framework/Versions/CurrentJDK/Home
… save and exit vi.
Restart Terminal app just to be sure that it worked, and try accessing it by typing:
$ echo $JAVA_HOME
If you see the correct JAVA path, then it is all done!
我的电脑显示如下:
macbookpro:bin shang$ echo $JAVA_HOME
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Here’s what had to be done:
- Start the Terminal app.
- Create/Edit ~/.bash_profile file.
Note: I first tried creating and using the ~/.bashrc file, but that didn’t work (Mac OS 10.6.2), while ~/.bash_profile worked as expected.
Therefore,
$ vi ~/.bash_profile
… and paste the following (make it a single line):
export JAVA_HOME=/System/Library/Frameworks/
JavaVM.framework/Versions/CurrentJDK/Home
… save and exit vi.
Restart Terminal app just to be sure that it worked, and try accessing it by typing:
$ echo $JAVA_HOME
If you see the correct JAVA path, then it is all done!
我的电脑显示如下:
macbookpro:bin shang$ echo $JAVA_HOME
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
相关文章推荐
- How to Set $JAVA_HOME environment variable on Mac OS X
- How to fix the issue that GEM_HOME and/or GEM_PATH not set issue for rvm in mac version 10.12
- How to tell if you’re running the 32 bit or 64 bit kernel in Mac OS X Snow Leopard
- Error: JAVA_HOME not found in your environment. Please set the JAVA_HOME variable in your environmen
- Error: JAVA_HOME not found in your environment. Please set the JAVA_HOME variable in your environmen
- How to enable the root user in Mac OS X Lion
- How to set JAVA_HOME on mac
- How to implement the similar mechanism with Java final in c++?
- How to set up OpenERP for various timezone kindly follow the following steps to select timezone in OpenERP
- nrf51822 secure DFU by OTA: How to Set Password in the DFU zip File
- How to let "test2.c" use the variable in "test1.c"
- 如何Eclipse改变模板中${user}变量,How to change the variable ${user} used in the eclipse templates.
- Parsing Failure in config.xml: java.lang.IllegalArgumentException: In production mode, it's not allowed to set a clear text value to the property
- How to Set Up SQL Server 2008 FileStream In the Cluster
- The JAVA_HOME environment variable is not defined correctly This environment variable is needed to r
- How to set JAVA environment variables in Linux or CentOS
- How to set the current user on the model instance in the admin:
- 如何设置Java桌面程序界面外观(How to Set the Look and Feel)
- OSX 执行mvn install出现The environment variable JAVA_HOME is not correctly set
- How to set the style in valuelist