Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts

Install JAVA

The instructions below are for installing version Java 8 Update 73 (8u73). If you are installing another version, make sure you change the version number appropriately when you type the commands at the terminal

Example: For Java 8u79 replace 8u73 with 8u79

Note that, as in the preceding example, the version number is sometimes preceded with the letter 'u' and sometimes it is preceded with an underbar, for example jre1.8.0_73

1. Become root by running su and entering super-user password

2. Change to the directory in which you want to install. Type:

cd directory_path_name

For example to install the software in /usr/java/ directory, Type:

cd /usr/java

3. Uninstall any earlier installations of the Java packages

 rpm -e package_name

4. Install the package

rpm -ivh jre-8u73-linux-x64.rpm

To upgrade a package

rpm -Uvh jre-8u73-linux-x64.rpm 

5. Delete '.rpm' file if you want to save disk space 

6. Exit the root shell. No need

Install JDK / JRE in Oracle Linux / RHEL

To install Java in RHEL or Oracle Linux based Desktop machine, open a browser and navigate to Java SE official download page and grab the latest .rpm binary package in your system.

Install Java JDK / JRE 

After Java .rpm file download completes, navigate to the directory where Java package has been downloaded and install Java JDK/JRE by issuing the below command

# yum install jdk-<Version>_linux-x64_bin.rpm

# yum install jre-<Version>_linux-x64_bin.rpm

Setup Java Environment Variables

Next, insert Java environment variables and executable files path into your system $PATH variable by issuing the below commands
This method ensures that Java environment variables and executable will be accessible system wide

-------- Set JAVA_HOME and Path Variable JDK -------- 

# export JAVA_HOME=/usr/java/jdk-<Version>
# export PATH=$PATH:/usr/java/jdk-<Version>/bin

-------- Set JAVA_HOME and Path Variable JRE --------

# export JAVA_HOME=/usr/java/jre-<Version>
# export PATH=$PATH:/usr/java/jre-<Version>/bin

Check Java JDK / JRE Version

# java --version
java <Version{
Java(TM) SE Runtime Environment (build <Version>)
Java HotSpot(TM) 64-Bit Server VM (build <Version>, mixed mode)

Uninstall JAVA / JDK in Linux

Login as "root" user

Check the JAVA version

java -version

Query JDK / Java

rpm -qa | grep jdk

or 

rpm -qa | grep java

Uninstall / remove JDK / JAVA

yum -y remove jdk*

or

yum -y remove java<version name>

How to fix: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Open your terminal and type mysql -u root -p Enter your password. Hopefully your MySQL is logged in now.