Setting up Java Development Environment on Ubuntu Gutsy, Part 2: Configuring Java Environment Variables on Ubuntu Gutsy

The default command line interface for Ubuntu Linux is called bash (Bourne Again Shell), and in order to add Java environment variables, we will edit a file named “.bashrc” and add our commands inside, here we go:

  1. Edit the “.bashrc” file by typing “sudo gedit .bashrc” which will open gedit; the famous Linux text editor in Read/Write mode (Note: If you don’t use the keyword sudo to get administrative privileges, then the file will be opened in Read Only mode)
  2. Scroll to the end of the file and add your env. variables as in the following example which I used to define the JAVA_HOME env. variable:
    1. Append this line to the end of the .bashrc file: “export JAVA_HOME=/usr/lib/jvm/java-6-sun” where I point this variable to the location of my default JDK
    2. Save the file and exit and close the terminal
    3. Reopen the terminal and to check that everything went fine, type the following command: “echo $JAVA_HOME” which should result in displaying “/usr/lib/jvm/java-6-sun”, otherwise, repeat the process again, you must have done something wrong.

About SoCRaT

Software Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s