Skip to main content

How to install Oracle JDK 7 in Ubuntu?


Now I am going to explain to you how we can install Oracle JDK 7 in Ubuntu. We can do this with a few simple steps.

What you have to do is to open the terminal in Ubuntu and type the following commands

                     sudo add-apt-repository ppa:webupd8team/java

                     sudo apt-get update

                     sudo apt-get install oracle-java7-installer

 Type your password whenever you are prompted to do so when executing these commands.

Oracle JDK 7 will now be installed in your computer. To verify this you can type the following command in the terminal.

                                                                     java -version

The following figure will show you how you will see the terminal after executing the above command. It should be something similar.




Now you are done. :)

In order to put the JDK that you just installed, to the PATH environment variable so that it can be accessed by any program that requires Java to run, you can follow the steps explained below.

You should edit the .bashrc file. Execute the following command for that.
                   
                                                                       gedit ~/.bashrc

I used gedit here. But you can use what ever the editor you want for that.

Now add the following lines to the end of the file .bashrc

                      export JAVA_HOME=the/path/to/the/directory/where/your/java/is/installed
                      export PATH=${JAVA_HOME}/bin:${PATH}

You should not change the second line, but change the first line accordingly.

To verify whether the variable is properly set, type the following command.

                                                                  echo $JAVA_HOME

Then you should see the path that you set getting printed on the terminal. If in case the path is not shown, you will have to restart your computer. Then the path will be shown if you have correctly followed the steps given above.

Now you are ready to go. Cheers. :)







Comments

Popular posts from this blog

How to import the Public Certificate of one WSO2 product to the trust store of another?

To demonstrate this point, I will use the 2 products WSO2 API Manager 2.1.0 (referred as APIM from here onwards) and WSO2 Enterprise Integrator 6.1.1 (referred as EI from here onwards). When using EI as the Business Process Server during configuration of Workflows in APIM, one step to perform is to import the public certificate of EI to the truststore of APIM [1]. So now let's see how this can be done. Step 1: Go to <EI_HOME>/repository/resources/security/ folder and execute the following keytool command. This command is used to export the public certificate of EI as a certificate file called wso2carbon.cer. Since the default keystore in EI is wso2carbon.jks, we have specified it as the keystore and the default alias is wso2carbon. Provide wso2carbon as the keystore password when prompted as it is the default password. After executing the above command from within the security folder in EI, you will see that a file with the name of wso2carbon.cer is created...