- 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)
- 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:
- 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
- Save the file and exit and close the terminal
- 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.
Sunday, November 11, 2007
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: