Skip to main content

Installing Java on Ubuntu


The Java Technology is both a programming language and a platform [1]. The java platform is one on top of which java programs run and it can be described as a software-only platform that runs on top of other hardware based platforms. The Java platform consists of these two major components [2].
  • The Java Virtual Machine
  • The Java Application Programming Interface (API)

The importance of installing java on your local machine is due to the reason that many web and  desktop applications may be partially or fully dependent on the java run-time. Therefore it is essential to install a version of java into your local machine.

This tutorial guides you through a simple mechanism to install java on the Ubuntu platform.


1. First open up a terminal in your Ubuntu environment

2. Update the existing packaging index by entering the following command in the terminal


$ sudo apt-get update                                                     


3. Check if java is available with the following command. If it is available you do not need to install it again.

$ java -version                                                           

4. If not available then install java to your ubuntu environment using the following command. This will install the official JDK which is the one distributed by Oracle.

sudo apt-get install oracle-java7-installer                         


or

$sudo apt-get install oracle-java8-installer                          

You can select either one of the above depending on the java version that you want to install.

Please note that some applications have not yet been migrated or have not been developed to use the latest java release which is java8. Therefore when determining the version please consider the above or the program may fail to run.



5. Ideally the installed version on java should reside in /usr/lib/jvm directory. If you are unable to locate it there then enter the following command in your terminal and you should be able to locate the installation directory of java. 


$ whereis java                                                                                                                         


6. Now java is installed. nest we need to add the java path to the existing classpath. Therefore we need to set the $JAVA_HOME environment variable. In order to set this variable we need to navigate to the home directory and edit the .bashrc file.


cd /home/shenavi                                             
(note that /home/shenavi is my home folder)


shenavi@shenavidemel:~$ sudo vi .bashrc                                                                            



7. You can also open this file using any other text editor with the admin user. (using the sudo command). After opening it navigate to the bottom of the file and add the following two lines at the end where /usr/lib/jvm/java-7-oracle is the installation directory of java. If the installation directory differs from this replace that in the java home below.


export JAVA_HOME=/usr/lib/jvm/java-7-oracle                                                                  
export PATH=${JAVA_HOME}/bin:${PATH}                                                                   



8. After this change save changes and close. Now java is successfully installed in your machine. To check the installation you can go to your terminal and enter the command mention in step 3.

Or you can simply type java or javac in the terminal and observe the possible options to use with the newly installed java. Which means you have now successfully installed java on your Ubuntu platform.




References

[1] https://www.java.com/en/download/faq/whatis_java.xml

[2] http://docs.oracle.com/javase/tutorial/getStarted/intro/definition.html

Comments

Popular posts from this blog

Processing large payloads with the esb script mediator iteratively

Overview WSO2 ESB uses Rhino engine to execute JavaScripts. Rhino engine converts the script to a method inside a Java class. Therefore, when processing large JSON data volumes, the code length must be less than 65536 characters, since the Script mediator converts the payload into a Java object. However, you can use the following alternative options to process large JSON data volumes. The script mediator which is used in ESB is powered by the Rhino engine. Therefore, when processing large JSON data volumes, the code length must be less than 65536 characters which is a limitation in the script mediator being used in the esb versions less than 5.0.0. In ESB 5.0.0 there is a higher capability to process larger payloads using script mediator. In order to process such large payloads we can follow the below two approaches. 1. Replace the javascript tranformation logic using java code by writing a custom mediator. [1] 2. Break down the large payload and execute them as sections using

Exposing a SOAP service as a REST API

In this post i will be explaining how we can transform a SOAP based backend to receive requests in a restful manner through the WSO2 API Cloud. Steps. First log into the WSO2 Cloud and navigate to the API Cloud. In the API cloud select the option to add a new API. We will be creating an API to demonstrate an invocation to the backend soap service ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl Give a name, context and version to the API and add a resource name with a GET Method. The resource name can be anything which you like since we will invoke the actual service usiing a custom sequence. Mention the URI template as indicated in the below screenshot. Next go to the implement tab. And select the endpoint type as HTTP/SOAP Endpoint and specify the endpoint as http://ws.cdyne.com/phoneverify/phoneverify.asmx. There is an important step we need to do here. We need to set the SOAP version for this request. In order to do that we need to select the advanced option for the e

Invoking external endpoints using the call mediator in wso2 api manager

Introduction In API Manager if you need to do any service chaining use cases the call mediator comes in handy. If you need to use the response received by invoking one endpoint and then use it to invoke another endpoint you can use the call mediator in API Manager. The call mediator behaves in a synchronous manner. Hence, mediation pauses after the service invocation and resumes from the next mediator in the sequence when the response is received. You can read more about the call mediator in the wso2 esb documentation [1] . In api manager 1.10.0 the call mediator works in the blocking mode. Prerequisite Before we can use the call mediator in API Manager 1.10.0 we need to make the following changes to some configs. We need to comment the jms transport sender in axis2_blocking_client.xml found in the location APIM_HOME/repository/conf/axis2. This will resolve the jms sender initialization issues.   <!--transportSender name="jms"                      class