Friday 26 August 2011

set JAVA_HOME envoirment

FOR WINDOWS:
Please follow the instructions to set up JAVA_HOME environment variable in your computer. First find out the installation folder of Java development kit (JDK) in your machine. Let's assume it is installed in the folder "C:/j2sdk1.4.2"

1 Right click on the My Computer icon on your desktop and select properties
2 Click the Advanced Tab
3 Click the Environment Variables button
4 Under System Variable, click New
5 Enter the variable name as JAVA_HOME
6 Enter the variable value as the install path for the Development Kit
7 Click OK
8 Click Apply Changes

FOR LINUX:

~/.bash_profile is a startup script which generally runs once. This particular file is used for commands which run when the normal user logs in. Common uses for .bash_profile are to set environment variables such as PATH, JAVA_HOME, to create aliases for shell commands, and to set the default permissions for newly created files.
Set JAVA_HOME / PATH for single user

Login to your account and open .bash_profile file
$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Set PATH as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file. Just logout and login back to see new changes:
$ echo $JAVA_HOME
$ echo $PATH
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
$ which java

No comments:

Post a Comment