Preparing and updating Ubuntu 10.10 “virgin” to develop Java since Eclipse

[En Español:  https://josemmsimo.wordpress.com/2012/08/22/preparando-y-actualizando-ubuntu-10-10-virgen-para-desarrollar-java-desde-eclipse/]

I decided to use version 10.10 because I have more affection, has the environment as I like and don’t fail me without knowing why.

I do not know which is your opinion about it. Here I refer you how to update and prepare for programming with Eclipse. I use it via VMWare, so I can use Windows and Linux at the same time, according to my necessities. Indeed, I’ll use this post as pin because usually I forgot some steps, so some things that you can look “strange” :P

Steps to follow? Presumably you must have a system Ubuntu 10.10. Almost everything we do it will be in the terminal, and when I enter something beginning with $ it will be a command (this is basic, but some people may not know it). Moreover, many things need to be done as superuser (root), so we opened the terminal and directly put it to work as root:

$ sudo su

Put the password, and you will see a sign (#) in front (I even so write a dollar ($)).

As a personal hobby, to put the buttons to minimize, restore / maximize and close to the right:

  • Press Alt + F2.
  • Write: gconf-editor
  • In the new window on the left: app / metacity / general
  • Find the entry called button_layout
  • Delete whatever brings in that field and you put: menu:minimize,maximize,close
  • Enter button and you will see the little buttons on the right.

First command to execute: I recommend you do it one by one. If do not know them, use Google and ask what he does.

$ apt-get update
$ apt-get upgrade
$ apt-get install aptitude
$ aptitude update
$ aptitude upgrade

Add repositories (I took this to the version of Java you want, there are many more):

$ sudo add-apt-repository “deb http://archive.canonical.com/ubuntu maverick partner”
$ sudo apt-get update

To install the browser Chrome in Ubuntu (Chromium), my favorite browser :P The 2nd line is to copy the flash plugin to the plugins folder of chrome.

$ sudo apt-get install chromium-browser chromium-browser-l10n flashplugin-installer
$ sudo cp /usr/lib/flashplugin-installer/libflashplayer.so /usr/lib/chromium-browser/plugins

To install JRE and JDK:

$ sudo apt-get install sun-java6-jre
$ sudo apt-get install sun-java6-jdk

To install Java in the browser and fonts (Lucida TrueType fonts Java).

$ sudo apt-get install sun-java6-plugin sun-java6-fonts

To update Java ( may be useful):

$ sudo apt-get install update-java
$ sudo update-java

To check Java version:

$ java -version
$ javac -version

At one point you can have multiple Java versions installed, so be careful with their priorities. Using this command you can choose the alternatives. In this case it is best to use the 3rd:

$ sudo update-alternatives –config java

There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-sun-1.6.0.26/bin/java 66 auto mode
1 /usr/lib/jvm/java-6-sun-1.6.0.26/bin/java 66 manual mode
2 /usr/lib/jvm/java-6-sun/bin/java 65 manual mode
3 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number:

To properly set up the variable path JAVA_HOME (and keep us program without problems in Linux). First, make sure you have things “on their site”:

$ ls /usr/lib/jvm/java-6-sun

If you do not get anything review the steps above. If things go, perfect! Now run the following command:

$ sudo gedit /etc/bash.bashrc

In the file that was opened, paste these lines at the end:

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin.

Save the changes, close the file, and restart the computer.

Ok, now let’s install Eclipse. In my case, the version will download Eclipse IDE for Java EE Developers (Eclipse Juno by the way) for 32-bit Linux. Web: http://www.eclipse.org/downloads/

Once downloaded, unzip the file and save the folder in a directory. In my case I will keep it within the current user folder (home folder): /home/myuser

The path should be something like this then: /home/myuser/eclipse     Within that folder, we will have to click on the executable “eclipse”, so for convenience I suggest making a shortcut to the desktop.

When starting eclipse, it lets you use the workspace you suggest, and I will do so within the user folder (you can choose another route if you prefer): /home/myuser/workspace

After starting Eclipse, we can create our “Hello World” in Linux :)

public class Ejemplo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Hola mundo");
	}

}

 

Leave a comment

Por favor, inicia sesión con uno de estos métodos para publicar tu comentario:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s