Chủ Nhật, 29 tháng 3, 2015

How to setup Java in Ubuntu ?

Answer:
To setup Java on Ubuntu OS, follow these steps:
1.  Download the JDK package on Oracle page (java7 click here), the package will be stored in /home/your account/Downloads/, assume jdk-7u75-linux-x64.tar.gz.
2. Copy the file to /usr/local or run the command: cp /home/your account/Downloads/jdk-7u75-linux-x64.tar.gz /usr/local
3. Extract the file you have just copied into /usr/local or use the command: tar xzf /usr/local/jdk-7u75-linux-x64.tar.gz, it will extract to the new folder, like jdk1.7.0_75.
4. Now we need to add new environment variable $JAVA_HOME and also add $JAVA_HOME/bin to $PATH:
  • Open the file /etc/profile or run command: sudo gedit /etc/profile
  • Add two lines and save it:   
    • export JAVA_HOME=/usr/local/jdk1.7.0_75
    • export PATH=$PATH:$JAVA_HOME/bin 
  •  Log out and log in again.
5. Now you finished the setup Java on the Ubuntu environment. Check Java version again by command: java -version.

Leave a comment if you got problems, I'll help if it's possible.

Không có nhận xét nào:

Đăng nhận xét