Bash command to check if Oracle or OpenJDK java version is installed on Linux

openjdk version
check openjdk version windows
how do i know if i have openjdk or oracle jdk
install java on linux command line
check java version linux
how to check openjdk path in linux
check if openjdk is installed windows
openjdk vs oracle jdk

I need a bash line to check if java version currently installed is Oracle's or OpenJDK.

A one-liner by parsing the output of the java -version command:

java -version

java Oracle output:

java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

java OpenJDK Output:

java version "1.7.0_91"
OpenJDK Runtime Environment (amzn-2.6.2.2.63.amzn1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

if [[ $(java -version 2>&1) == *"OpenJDK"* ]]; then echo ok; else echo 'not ok'; fi

Bash command to check if Oracle or OpenJDK java version is , if [[ $(java -version 2>&1) == *"OpenJDK"* ]]; then echo ok; else echo 'not ok'; fi. A typical output from running the same command to check the version for an OpenJDK version would be: $ java -version openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) Sumit Kumar is just checking for this using bash


java -version 2>&1 | grep "OpenJDK Runtime" | wc -l

returns 0 if using Oracle JDK, 1 if using OpenJDK

Bash condition:

if [[ $(java -version 2>&1 | grep "OpenJDK Runtime") ]]

Checking the Java version on Linux, Procedure. Open a Linux command prompt. Enter the command java -version. If Java version is installed on your system, you see a Java installed response. Bash command to check whether Oracle or OpenJDK java version is installed on Linux I need a bash line to check if java version currently installed is Oracle's or OpenJDK. A one-liner by parsing the output of the java -version command: java -version java Oracle output: java version "1.7.0_80" Java(TM) SE Runtime Environment (bu


You can use below shell script for you work:

#!/bin/bash

declare -a JAVA=($(sudo find / -name java | grep -v grep | grep "/bin/java"))

for javapath in "${JAVA[@]}"
do 
 if [[ $(sudo  ${javapath} -version 2>&1) != *"OpenJDK"* ]]; then 
    export JAVAVER=$(${javapath} -version 2>&1);
    echo "Java Location -- ${javapath}"
    echo "${JAVAVER}"

 fi
done

NOTE: This will cover all java executable files running on you hosts.

How to Check if Java is Installed, Learn how to find out if Java is installed on a Windows 10, Mac OS X or Linux/ Unix machine even if it's not on the PATH. Going to a command line and typing java -version can tell us for sure if Java is installed. However, if we see an error i oracle-java8-jdk - Java™ Platform, Standard Edition 8 Develop. Open a Linux command prompt. Enter the command java -version. If Java version is installed on your system, you see a Java installed response. Check the version number in the message. If Java is not installed on your system, or the version of Java is earlier than 1.6, use the Linux Yellowdog Update, Modified (yum) utility to install a compatible version. If the 64-bit version of Java V1.6 is not installed, the installation does not complete successfully.


Installation of the JDK and JRE on Linux Platforms, This topic describes the installation procedures of the JDK and JRE on the Linux platform, along Java Platform, Standard Edition Installation Guide See Oracle JDK 9 and JRE 9 Certified Systems Configurations for information about supported However, it may involve manual steps to get some of the features to work. I need a bash line to check if java version currently installed is Oracle's or OpenJDK. A one-liner by parsing the output of the java -version command: java -version java Oracle output: java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) java OpenJDK Output:


JDK Installation for Linux Platforms, However, it may involve manual steps to get some of the features to work (for example, the -version: release option of the java command, which allows you to� March 25, 2019 at 11:10 AM delete Hello, I followed your instructions and worked perfect. Except I have a few questions. Before looking at this article I installed the openjdk version.


Ubuntu Linux Find JDK Version, How do I find out my JDK version under Ubuntu Linux operating systems? Terminal), and then type the following command to find out JDK version: java - java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.2) To list all installed jdk version under Ubuntu / Debian Linux, enter: As the user running the Oracle Database one can also try $ORACLE_HOME/OPatch/opatch lsinventory which shows the exact version and patches installed. For example this is a quick oneliner which should only return the version number: $ORACLE_HOME/OPatch/opatch lsinventory | awk '/^Oracle Database/ {print $NF}'