I was trying to set up Fedora Object Repository for my assignment which need some environment variable to be set especially Java. I posted blog on how to choose Java VM in Ubuntu. Location of Java in Mac OS is different from linux or ubuntu.
Java home path in Mac is:
To set the environment variable is:
Bear in mind that issuing ‘export’ command from the terminal is only meant for that terminal only. The environment variable is not being set globally. So in order to define the environment variable so whole Mac application is able to see them.
- Create a folder in the user root directory called .MacOSX
- Create a file called environment.plist in the directory, so when you issue pwd command you will see /Users/lindaoctalina/.MacOSX/environment.plist
- In environment.plist, create an xml document with the following format:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SOME_OTHER_ENV</key>
<string>/full/path/use/semicolon/to/separate:/if/you/have/more/than/one/path:</string>
<key>JAVA_HOME</key>
<string>/System/Library/Frameworks/JavaVM.framework/Home:</string>
</dict>
</plist>Note: you must use full path instead of ~ for home directory
- Log out and log back in whenever you modify environment.plist to see the changes
Useful Link:
1 comment
Alex says:
May 19, 2010 at 10:14 am (UTC -4)
Thanks for this post, it was really helpful.