I normally don’t mess with Java so this is likely a trivial point, I could very well be stating the most obvious of obvious things.
The documentation for Amazon’s EC2 Web Service actually had a well written explanation, but who reads? Scanning the setup instructions I saw:
- Java. — Check, I got that
- Java JRE version 1.5 — Check?
[smbrown@jrcash$] java -version - JAVA_HOME — Check?
[smbrown@jrcash$] which java - FAIL
JAVA_HOME is /Library/Java/Home it is the location where the sub folders bin/java/
What is my “JAVA_HOME“? it is “the full path of the directory that contains a sub-directory named bin which in turn contains the java“
To see your current JAVA_HOME:
[smbrown@jrcash$] echo $JAVA_HOME
To set a JAVA_HOME, insert this in your ~/.profile:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
What is a better way to confirm your real Java version JAVA_HOME on OS X?
[smbrown@jrcash$] $JAVA_HOME/bin/java -version
Thanks for taking a look you can go back to Twittering now. =)
Update (January 10, 2009): Amazon released their AWS Web Console, here’s an early tour.
This is like a foreign language to me.
Totally foreign, it is Java
Pingback: Setting JAVA_HOME on Mac OS X 10.5 — Entrepreneur Geek
May I know where is .profile ? I am trying to set Java_Home. I use soylatte16-i386-1.0.3 . It is located at /sw/soylatte16-i386-1.0.3/
I am having hard time to use it. I am using Intel-Mac Duo core (32-bit).
I went to :
http://wiki.netbeans.org/JavaFXAndJDK6On32BitMacOS#section-JavaFXAndJDK6On32BitMacOS-NotesAndTips
but having problem to Open the X11.app and set it up to use the new JDK.
Please help. Thank you.
@michael
1. Open up Terminal.app (Applications >> Utilities >> Terminal)
2. type: emacs .profile
3. add this to the end of the .profile file:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
4. Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
5. open a new Terminal window (cmd-n) and type: $JAVA_HOME/bin/java -version
If you see something like:
java version “1.5.0_16″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
Then you’ve successfully set your JAVA_HOME environment variable to the binary stored in /Library/Java/Home/bin/java
thanks for this quick info… new to apple / osx and this was helpful
that’s a good tips smbrown..
that sure help me a lot
thanks though….. lol
Thank you – I’m doing exactly the same thing (setting up access to EC2 on a Mac) and failed at exactly the same point.
I am unable to locate .profile. When I do sudo pico ~/.profile or emacs ~/.profile, I get a new empty file.
And then when I type in ‘env’ i get a full listing of properties as:
MANPATH=/usr/share/man:/usr/local/share/man:/usr/X11/man
TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
TMPDIR=/var/folders/v9/v9F-5i-mGyqUKWHxyRLiMk+++TI/-Tmp-/
Apple_PubSub_Socket_Render=/tmp/launch-wwV61I/Render
TERM_PROGRAM_VERSION=240.2
USER=Samantha
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-oCus7e/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
PWD=/Users/Samantha
LANG=en_US.UTF-8
SHLVL=1
HOME=/Users/Samantha
LOGNAME=Samantha
DISPLAY=/tmp/launch-hwKeaW/:0
SECURITYSESSIONID=833f10
_=/usr/bin/env
——–
Now where are these properties coming from? These properties are in some file and I can’t locate them. What should I do?
@ilango gurusamy
You can add these lines to a new, empty file in ./profile
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
save and then open a new terminal window to view the changes. The other settings set at login by the system-wide bash settings (vs. the user-specific environment settings which are kept in ./profile)
Thank you. I would like to add a link to your blog in my blog where I am writing up my own account of how to set up Java 6 for Mac OS Leopard. Can I do that?
Is there any other way I can acknowledge your help in solving my problem?
@ilango gurusamy
Thanks! A link to this post would be great. Glad it helped you out. Sean
I have added a hyperlink in my blog that links to your blog.
Thanks!! This has really helped especially how to locate and add the ./profile.
Before I did .profile I created a variable called environment.plist, copied the value of JAVA_HOME into it with the export statement and logged back in. This solved the problem.
This is very helpful — THANKS!!
photoshop
Thanks for the info.
I wrote the following in ~/.profile:
export JAVA_HOME=/Library/Java/Home
but it turns out that when I type echo $JAVA_HOME
it only returns a blank line.
Why is that?
Thanks!