Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, November 12, 2009

Installing Java in Ubuntu Linux

One of the reasons I love Ubuntu (Linux) is because it comes with a great number of packages.

Ubuntu has the following Java packages

sun-java6-bin – Contains the binaries
sun-java6-demo – Contains demos and examples
sun-java6-doc – Contains the documentation
sun-java6-fonts – Contains the Lucida TrueType fonts from the JRE
sun-java6-jdk – Contains the metapackage for the JDK
sun-java6-jre – Contains the metapackage for the JRE
sun-java6-plugin – Contains the plug-in for Mozilla-based browsers
sun-java6-source – Contains source files for the JDK

Here is a quick and dirty way to install Java in your Ubuntu desktop / server

Edit the sources list
$ sudo nano /etc/apt/sources.list
Insert the following lines at the end of the file

deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse

Save (Ctrl+O ) and Exit (Ctrl+X) the file.

Update apt
$ sudo apt-get update
Now in terminal run the command line
$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
Agree to the terms and java will install automatically.


Test that Java install is successful
Run command
$ java -version
You will get something like
java version “1.6.0″
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
________________________________________________________

For manually installing java, you may follow the instructions here
http://sites.google.com/site/easylinuxtipsproject/java#TOC-HOW-TO-FOR-32-BIT-UBUNTU
________________________________________________________

Saturday, September 12, 2009

Installing java in Ubuntu Linux

On Debian/Ubuntu Linux for example all you need to do is make sure that your apt-get is pointed at the right place. In your /etc/apt/sources.list add in the following (and make sure you are okay with adding in stuff that is not in the default environment).

deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse

After this have apt updates its repository

sudo apt-get update

And finally, just tell it to install java :)

sudo apt-get install sun-java5-jdk

After this the rest of the process will display a dialog that will require you to accept the license agreement. When you do, the rest of the setup will happen on its own.

When you're on the command prompt type

javac -version

or

java -version
_____________
Edit: There is an Update to this post

Thursday, July 2, 2009

Installing Java Runtime Envoriment in Linux - Fedora, RedHat, CentOS distros.

This is actually meant for Fedora, RedHat, CentOS distros.

(1.)log into your root user.

(2.)Go to this link ( http://java.sun.com/j2se/1.5.0/download.jsp ) and download the Linux self-extracting file (jre-1_5_0_07-linux-i586.bin) NOT THE RPM!

(3.)Move jre-1_5_0_07-linux-i586.bin to your /opt/ folder.

(4.)Open the terminal and type "cd /opt/" without the ".

(5.)[root@localhost opt]# sh ./jre-1_5_0_06-linux-i586.bin
(type 'yes')

(6.)[root@localhost opt]# mv -f jre1.5* /opt/jre1.5

(7.)[root@localhost opt]# ln -s /opt/jre1.5/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla plugins/libjavaplugin_oji.so

Now we will install the JRE package into Mozilla through 'alternatives'. When Mozilla runs 'java' command, FC5 will always choose the default "GNU Java" for Mozilla to choose Sun's java do the following.

(1)[root@localhost opt]# /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5/bin/java 2
(2.)[root@localhost opt]# echo 2 | alternatives --config java
"It will ask to choose which one, Type "Echo 2" then go to number (3.) below"

(3.)[root@localhost opt]# java -version
When you enter this, It will tell you the version of the java that you just installed. IF it doesn't show anything or gives you an error, Delete the jre1.5 folder in /opt/ start over.

This is what it should look like (see below) if you done it right.

[root@localhost opt]# java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02)
Java HotSpot(TM) Client VM (build 1.5.0_19-b02, mixed mode, sharing)