Set JAVA_HOME / PATH variables In Linux OS

         In my last post we discussed about how to install JDK in Ubuntu platform. You installed it means, it looks lyk u  took interest in Linux.. Its good to see. U knw actually windows sucks, when u try linux distribution u ll get it (Now u r dat much of smart than i m expecting, because u r Linux user :) ). 

     Now we discuss about _
     
     How to set JAVA_HOME and PATH?

     And here is the answer step by step 

1. ~/.bash_profile    
   this file helps u to set environment.
   Open Terminal window. (U installed JDK means u knw how to open it, m i right !)

2.  Open file ~/.bash_profile using following line in your teminal_
     rohantu@ubuntu:~ $ vi ~/.bash_profile


3. Set JAVA_HOME as follows  export JAVA_HOME=<java-path>in that file you can use below line for JAVA_HOME_
     export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java  


4. Set PATH in same file as follows:
     export PATH=$PATH:/usr/java/jdk1.5.0_07/bin


5. And you finished it. but wait you need to log out and login again to your system. Because ~/.bash_profile is a startup script which runs once when you loged on. This file is mostly uses for set PATH, JAVA_HOME etc ..and to set the default permissions for newly created files.
     rohantu@ubuntu:~ $ echo $JAVA_HOME


6. once check for environment veriables is set or not using following command in ur terminal_
     rohantu@ubuntu:~ $ echo $PATH 

>>Anoter way to Set JAVA_HOME / PATH for all user

    Instead ~/.bash_profile you use /etc/profile OR /etc/bash.bashrc file for all   users:
  • Open file in terminalrohantu@ubuntu:~ # vi /etc/profile
  • Next setup set PATH / JAVA_PATH variables as follows:

    export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
    export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
       Save and close the file.
You Done it.



Comments

Popular posts from this blog

Setting up/Install JDK in Ubuntu/Linux

SQLite Setup on Windows