Java remains the second-most popular coding language in the world according to the PYPL Index, and it ranks third among skilled professionals to develop high-performance applications across multiple platforms — only C and Python score higher.
As a result, you’ll often find Java running in the background of many Mac or Windows systems. However, if the version of Java you have isn’t up to date, applications may not work as intended — or may refuse to open at all.
In this piece, we’ll walk you through how to check your Java version in Mac and Windows to make sure the Java you’ve got is the one you need.
When it comes to Windows, there are two easy ways to check your Java version:
-
Check the Java Version Using the Control Panel
-
Check the Java Version Using the Command Line
If you’re a Mac user, you’ve also got two simple options:
-
Check the Java Version Using System Preferences
-
Check the Java Version Using the Terminal
Let’s break down each method in more detail.
How to Check Java Version in Windows
1. Check the Java Version Using the Control Panel
If you’re a Windows user, the Control Panel approach is quick and easy.
First, click on the magnifying glass icon at the bottom-left of your desktop.
Next, type in “About Java” in the search bar that appears, then click on the “About Java” app that appears. If it doesn’t come up, try “Configure Java”. If you’re still having no luck, you probably don’t have Java installed.
Once you click through on About Java or Configure Java, you’ll see a pop-up window indicating the current version and build number.
2. Check the Java Version Using the Command Line
You can also check your Java version in Windows using the command line.
First, click on the magnifying glass and type “cmd”, then click on the Command Line app icon that appears.
Now, enter the command java -version and you’ll see the version of Java listed.
The video below not only covers these two common methods but an additional third method as well.
How to Check Java Version in Mac
1. Check the Java Version Using System Preferences
To check your Java version on a Mac without leaving the GUI, start by clicking the Apple icon in the top left-hand corner of your screen, then select “System Preferences.”
Next, find and click on the Java icon in the list of programs shown.
Finally, click on the “About” button to see the version of Java you’re currently running.
2. Check the Java Version Using the Terminal
Checking your Java version on Mac using the terminal is similar to using the Windows command line.
First, find and click on the spotlight search bar in the top-right corner of your screen, then type in “terminal” and click on the terminal icon.
This will bring up the command line. From here, you enter the same command as in Windows, java -version to get your current version details.
Worth noting? On both Windows and Mac devices, you can use the command javac -version to check the version of your primary Java compiler. This video can show you how:
Checking Your Java Version
And there you have it: Four simple ways to quickly check your Java version and make sure you’ve got the newest, freshest Java served up and ready to go.
Java is a programming language that is platform-independent, popular, simple, secure, and statically typed. Before discussing let’s clear Java language needs a runtime platform so before going ahead let’s clear how java is present on the machine.
Java language comprises three components mainly:
- Java Development Kit
- Java Runtime Environment
- Java Virtual Machine
Runtime Concepts than only we will check whether Java is there on the Platform (Operating System + Architecture)
1. Java Virtual Machine
This is a machine–specific software which is responsible for byte code on that machine and converts it into machine-specific instructions.
JVM is different for Windows JVM is different for Linux JVM is different for Different Platforms
So as a programmer we don’t need to check presence on the machine as it is pre-installed in the machine. It is responsible for running Java code line by line.
2. Java Runtime Environment
It is simply a package that provides an environment to only run our java code on the machine. No development takes place here because of the absence of developmental tools.
3. Java Development Kit
It is also a package that provides an environment to develop and execute where JRE is a part of it along with developmental tools.
- JDK = JRE + Developmental Tools
- JRE = JVM + Library Classes
Now, The first and Foremost step is to check the Java Development Kit in Windows which is also known as JDK. There are lots of versions of Java. Depending upon the operating system methods there are several methods to find the version of Installed JAVA on your Machine:
Let us discuss 3 standard methods in Windows
- User needs to open Command Prompt and enter- ‘java -version’
- Open control panel and lookup for Java
- Directories method- Click the Menu ‘Start’ and typing About.java or readme file
Taking one by one, showcasing in-depth individually
1. Command Prompt
The CMD (Command Interpreter is a command-line Interface. It supports a set of commands and utilities; and has its own programming language for writing batch files. Open CMD and search java -version. First, we have to an environment variable to the installed path location of the java folder. Otherwise, it will show invalid command. It is called ‘Terminal’ in the case of mac operating systems.
java -version // CMD/Terminal command to check java version on the machine
In the case of Windows OS: It is showing java is installed on the machine with version 1.8.0 (See carefully at line number 5)
“1.8.0_144” is the version of the java
In the case of macOS: It is showing java is installed on the machine with version 14.0.1 ( see carefully at line number 2)
Second Method:
- Open Control Panel and there is an option of the java on the interface of the control panel
- Click on the java option and click about a small pop window will appear
In the case of Windows:
In the case of Mac: Click on the Java icon downside. System preferences in mac are the same as the Control panel in Windows.
Third Method:
Search Program and features in the control panel and search JAVA Named option
In the case of Windows: Simply custom search- About Java
In the case of Mac:
Press the command button followed by a spacebar without lifting fingers from the command button.
A popup box will appear for less than a second followed by another pop-up as shown below:
Last Updated :
29 Oct, 2020
Like Article
Save Article
Загрузить PDF
Загрузить PDF
На одном компьютере может быть установлено несколько копий Java, и, если у вас несколько браузеров, каждый из них может использовать свою версию или не использовать вовсе. В этой статье описано несколько способов, как это проверить.
-
1
Откройте новое окно в вашем браузере и кликните сюда для перехода на сайт Java. Oracle, разработчик платформы Java, создал простую страницу, которая проверяет установленную у вас Java и сообщает точную версию. Это можно сделать из любой операционной системы.
-
2
Для начала нажмите кнопку «Проверить версию Java».
-
3
При появлении запроса от программы безопасности вашего браузера, позвольте Java подтвердить версию.
-
4
Через несколько секунд проверьте результаты! Они будут включать номер версии и номер обновления. Номер версии наиболее важен, если вы проверяете на совместимость с другими программами.
Реклама
-
1
Нажмите сочетание клавиш windows + r и введите «cmd» и в открывшейся командной строке введите java -version. Результат будет выглядеть примерно так: Java version «1.6.0_03 Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing).
-
2
На компьютере, на котором не установлена ни одна из версий Java от Sun Microsystems, это приведет к сообщению об ошибке: ‘java’ is not recognized as an internal or external command, operable program or batch file (‘Java’ не распознается как внутренняя или внешняя команда, исполняемая программа или пакетный файл).
-
3
На компьютере, на котором установлена только очень старая версия Java от Microsoft, будет такое же сообщение об ошибке. На машине с несколькими версиями Java эта команда вернет версию JVM по умолчанию.
Реклама
-
1
Откройте Жесткий диск, расположенный на Рабочем столе ИЛИ вы можете нажать меню поиска и открыть Приложения.
-
2
В окне Жесткого диска перейдите к Приложениям, затем к Утилитам.
-
3
В Утилитах откройте Терминал и в Терминале наберите «java -version» и получите текущую версию java.
Реклама
-
1
Откройте окно терминала и в нем наберите «java -version»
- Эта команда должна вернуть что-то вроде: Java(TM) 2 Runtime Environment, Standard Edition (build 1.6) Если она возвращает -bash: java: command not found, это означает, что либо java не установлена, либо вы не указали пути правильно
-
2
Используйте бесплатные Интернет-тестеры, перейдите сюда и нажмите на кнопку Проверить версию Java. Перейдите по ссылке
- В Firefox 3 перейдите в Инструменты, нажмите на кнопку Дополнения и перейдите на вкладку Плагины.
- В Firefox 2 или 3: В Firefox версий 2 и 3 введите в строке адреса: about:plugins. Если Java установлена, там будет несколько записей Java.
- В Internet Explorer 7 или 8 перейдите в Инструменты, выберите Настройки Интернета и на вкладке Главные нажмите на кнопку Настройки Истории, нажмите кнопку Отобразить объекты, щелкните правой кнопкой мыши на элементе управления ActiveX и посмотрите его свойства. Каждый элемент управления ActiveX имеет «базовый код» и для каждого из элементов Java он будет отображать номер версии
Реклама
Похожие статьи
Об этой статье
Эту страницу просматривали 86 110 раз.
Была ли эта статья полезной?
To get your jdk location in Windows, run this at a command prompt:
where java
This lists any and all locations of java.exe, including from your JAVA_HOME. For example, the 3rd line here reflects my JAVA_HOME location, where I’m pointing to JDK 8:
C:Usersme> where java
C:Program FilesCommon FilesOracleJavajavapathjava.exe
C:Program Files (x86)Common FilesOracleJavajavapathjava.exe
C:Program FilesJavajdk1.8.0_202binjava.exe
Note for comparison that java -version
does not reflect my JAVA_HOME location and in fact shows java version 11 instead of 8:
C:Usersme> java -version
java version "11.0.15" 2022-04-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15+8-LTS-149)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15+8-LTS-149, mixed mode)
This is confusing because my Java compiles (e.g., via mvn) use JDK 8 since that’s what my JAVA_HOME is pointing to. (I’m not even sure where the version 11 it found came from; possibly from when I installed maven.)
Determining the difference between the JRE and JDK you’re running has never been straightforward. Seems like java -version used to be a way to do this, but no longer.
Adding to the complexity, you can also supposedly get your Java version info from Control Panel > Programs > Java > About. For me, that shows Version 8. That’s despite java -version showing version 11.0.15. And it doesn’t change even if I point my JAVA_HOME to JDK 11.
Note that this answer is also helpful. In my case, that helped me determine that I have java.exe and javac.exe at C:Program Files (x86)Common FilesOracleJavajavapath
and C:Program FilesCommon FilesOracleJavajavapath
. Depending on which one I have listed first in my Path variable, I get different results when i run java -version
or java --version
. The former seems to work when Java 8 is listed first; the latter when Java 11 is first.
This command should tell you what is currently providing the Java virtual machine (java
) and the Java compiler (javac
):
file /etc/alternatives/java /etc/alternatives/javac
This assumes the «alternatives» system is working properly, which might not be the case, depending on how Java has been «messed up» in the past. To check this, run:
file `which java javac`
If the alternatives system is working correctly and being used by Java, then you should see:
/usr/bin/java: symbolic link to `/etc/alternatives/java'
/usr/bin/javac: symbolic link to `/etc/alternatives/javac'
Otherwise please edit your question to provide details. Then it should be possible to give a more specific answer.
You can remove openjdk-6
with the Software Center. There are multiple packages associated with it, so you may need to remove more than one packages. (All the `openjdk-6 packages are listed here.)
Or you can use the command-line:
sudo apt-get remove openjdk-6-* icedtea-6-*
However, whichever method you use, you may want to check first to see what depends on these packages—you might have software installed that specifically needs version 6. (Probably not, but possibly.)
You can check for this by simulating the removal operation on the command-line:
apt-get -s remove openjdk-6-* icedtea-6-*
This will show you the effects of removing those packages, including what other packages would be removed as well. (You’ll notice that since this is a simulation, you don’t need sudo
.)
If you want to be able to continue using Java content online in your web browser (this is not the same thing as JavaScript), then before you remove any icedtea-6-
or openjdk-6-
packages (except perhaps openjdk-6-jdk
), you should make sure you have icedtea-7-
packages installed corresponding to whatever icedtea-6-
packages are installed.