Saturday, June 15, 2013
Today I will show you how to install Java on Ubuntu. New Linux users may find it difficult to install, so I will be sharing this post to help you people out. There are two procedures to do that. First is do it directly from terminal and the second is do it manually if you already have the binaries. We will show you the second procedure.

Step 1 : Download Java from Oracle Java SE Downloads . Download the appropriate version according to your platform architecture. [NOTE : The download link is subject to change. If dead please report it. ]

Step 2 ; Unpack the archive using the following command
tar xvzf <file-name> [ e.g. jdk-7u21-linux-x64.tar.gz ]
You will get a folder something named jdk1.7.0. 

Step 3 : Next we will have to create a directory named jvm and copy the extracted folder into it with following command.

mkdir jvm
cp -r <extracted-folder-name> jvm [ e.g. cp -r jdk1.7.0 jvm ]
Now we will have to move this jvm folder to /usr/lib directory.
sudo mv jvm /usr/lib . Enter password when asked.

Step 4 : Since we have successfully copied the folder, now we will only have to tell the Linux system where your Java is installed.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
  -It will tell that JRE is available
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
  -It will tell Java Compiler is available
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
  -It will tell Java Web Start is available

NOTE : There are many more executables that you may need to install like jar, javap, appletviewer and so on. Just perform the step 4 for installing any other features. We have just mentioned about java, javac and javaws. Also note that it is not mandatory to name the folder as jvm.

Hope this helps you. Keep coding   :)

0 comments:

Post a Comment

Total Pageviews

Followers


Labels

Popular Posts

free counters