Wednesday 9 January 2013

Textual Representation of logo

Set java environment permanently in Linux


i had multiple java environment in linux and everytime i had to change java path in shell by exporting path. i wanted  to change my jre from openjdk to jdk7 permanently .i tried using several methods including changing bash profile and export jdk path , but no method seems to be working for me . finally i found a way to do this 

Follow the simple steps:

1. To set the environment variables :

echo ‘export JAVA_HOME=/home/Downloads/jdk1.7.0′ > /etc/profile.d/jdk.sh
echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile.d/jdk.sh

2. You have to source the file you just created by typing:
source /etc/profile.d/jdk.sh

3. Test if Java environment is successfully installed by typing in this in the shell:
java -version