Ubuntu 12.04 is a LTS (Long Term Support) release, for desktop as well as server edition. Just after a fresh install of Ubuntu 12.04, you need to install few things to get everything running, atleast for common tasks (you may find my previous post useful – things to do after a fresh install of Ubuntu 12.04).
But, remember if you want to develop Java Applications then you need more (JDK, Docs etc) than just a JRE. So checkout this post – Install JDK on Ubuntu 12.04 if you want full development environment rather then just the run time environment.
Installing JRE/Java on Ubuntu 12.04
There are many implementation of Java Runtime environment but we will stick to the Open Source implementation of Java – OpenJDK (Open Java Development Kit). The latest stable version is openjdk-7 (although v 8 developer preview version is also available). a terminal (hit Ctrl+Alt+t, to open a bash shell or terminal or whatever shell (such as zsh) you prefer) and execute these command(s) –
If you’re using Ubuntu 11.10 (oneiric ocelot) beta1 (released on the first of this month), then first install some basic applications – if you want a list then go here – I’ve already covered in a post – 10 things to do after fresh installation of Ubuntu 11.10. Anyway, in this post you will learn how to install Java Run time Environment (commonly called as JRE) on Ubuntu 11.10.
Java is one of the most popular programming languages , so probably you would be running a lot of software written in Java i.e Java Runtime environment (includes JVM – Java Virtual Machines – which translate java bytecodes into native – executable machine codes, and so JVM makes the Java programs platform independent) is required if you want to run applications/programs that is developed using Java. Additionally – if you want to run applet programs (java applets – small programs that runs in a browser) then you will have to install a plugin for that.
Installing Java Run-Time Environment(JRE) on Ubuntu 11.10
There are many options when it comes to Java Runtime Environment (sun-jdk-jre, openjdk-jre …) but we will go for openjdk-jre (one of the most popular JDK – which is an open source equivalent of proprietary jre, it works well on Linux based distro such as Ubuntu, and it’s pretty stable too). You can install it either from Ubuntu Software Center (search for java or open jdk, don’t forget to select the add-on plugin for applets while installing jre),
or open a terminal (Ctrl+Alt+T) and execute the command(s) –
OpenJDK 7 Java Runtime
sudo apt-get install openjdk-7-jre
install Java for browser – firefox/chrome..
For running applets in your web browsers such as Mozilla Firefox or Google Chrome, you need to install icedtea plugin. Execute –
Java is an Object Oriented programming language whose syntax and features has highly influenced by C/C++.Java programs can also be embedded in web pages which requires Java Run Time Environment(JRE) in order to get executed.That’s why after the fresh installation of Ubuntu 10.10 Maverick Meerkat you would require JRE for surfing Internet without any lack of functionality;because a lot of websites now uses java Applets to do some client side computation.On Ubuntu open JDK(java Development Kit) is recommended.
Installing Java Run Time Environment in Ubuntu 10.10
To install JRE just go to Synaptic Package Manager and search for ‘jre’ and select the packages that says open jre/jdk.After marking the package click on Apply button to begin the installation procedure.Then wait until the installation is complete….that’s all you have installed JRE successfully on your Ubuntu 10.10 Maverick Meerkat.
Java is multi platform programming language.It uses JDK(includes jre) to create a class file from the source code and then the generated class file can be run on any computer by using Java Virtual Machine(JVM).So to write and execute java programs Java Development Kit(JDK) must be installed on the computer.
Installing JRE /JDK on Ubuntu 10.04 for java programming
If you have not installed the JDK yet, then first install jdk on ubuntu 10.04 and then return to this page.
When you have installed JDK successfully on ubuntu ,then you will be able to write and execute jav programs.Follow these simple steps to write and execute your first java program on ubuntu 10.04 –
How to compile and run java program on Ubuntu 10.04
1. Open Gedit OR Write click on Desktop and select Create Documents->Empty File.
2. Write this simple java code to test..
// A program to print some text. public class Welcome
// main method begins execution of Java application
public static void main( String args )
System.out.println("Welcome to Java Programming! on Ubuntu 10.04"); }// method main ends here }// end of the class Welcome
3. Save it as “Welcome.java” on your Desktop(or in any other directory).
4. Now compile this java program to create the class file by using this command on terminal(CTRL+ALT+T).
$ javac Welcome.java
5. Now you will notice a class file “Welcome.class” on your Desktop.Now JVM will execute this code through the command given below –
$ java Welcome
6. Then the java Program will be execute by jvm and you will see the following output. Hello World!
Welcome to Java Programming! on Ubuntu 10.04
JAVA is now the most widely used programming language for creating applications for web,gadgets,business…So you may want to install JRE(Java Runtime Environment) on your ubuntu 10.04 LTS for compiling and running JAVA based application.
Installing JDK through Command Line in Ubuntu 10.04
Use the following command to install JDK(Java Developement Kit) 6 on your Ubuntu 10.04 LTS
sudo apt-get install openjdk-6-jdk
It will automatically install other dependencies.
Install JAVA(JDK-JRE) from SPM(Synaptic Package Manager) in Ubuntu 10.04
First,search for JDK/java and select the package openjdk-6-jdk by marking for installation.It will ask you to mark some extra dependent softwares for installation,just click ok.Then click on Apply to start the download and installation process.Wait for few minutes until the downloading process will complete and installation will begin.JDK will be installed within few moments.In middle of the installation it will ask you to accept license terms for JRE,check the box to accept the license terms.You are now ready to use Java Development Kit(JDK) for creating java applications.