Install this theme
JAVA_HOME

Today, I got started with Amazon Web Services.

Among other things, you have to install some CLI tools, to help you interact with AWS.

To do so, there are comprehensive instructions for Linux/UNIX and Windows. Also, as usual, the Linux/UNIX instructions apply to Mac OS X, which I currently use.

To begin with, you have to define an environment variable JAVA_HOME to point at the directory that contains the executable file named “java”. Sadly, the instructions did not work for me (probably because I use the java version that comes preinstalled with the OS).

I got an

Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java.

error.

To fix this, I duckduckwent around and I found this great post.

In a nutshell (and for personal future reference), what you have to do:

1. in the terminal execute:

ls -l `which java`

The output will be something like:

/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

2. open your ~/.profile or ~/.bash_profile (or whichever one you use) with a text editor. If you don’t have any of these files, create one (I go with the ~/.bash_profile).

3. Insert the following line:

export JAVA_HOME=`/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home`

If you notice, what you insert, is what you got from the step 1 and appending the “_home” part (Actually that was the tricky part for my case).

That should do the job.

To confirm:

1. restart the terminal

2. execute:

$JAVA_HOME/bin/java -version

following the AWS instructions and the output should be something similar to:

java version "1.6.0_29"

Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)

Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

 
Blog comments powered by Disqus
Green Webhosting by InMotion Hosting