How to Get the Java Version In Powershell?

7 minutes read

To get the Java version in PowerShell, you can use the following command:

1
java -version


This command will display the installed Java version on your system. You can also use the command below to get the Java version information in a more readable format:

1
(Get-Command java).FileVersionInfo.ProductVersion


Running this command will output the specific version of Java installed on your system.

Best PowerShell Books to Read in October 2024

1
Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS

Rating is 5 out of 5

Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS

2
PowerShell Cookbook: Your Complete Guide to Scripting the Ubiquitous Object-Based Shell

Rating is 4.9 out of 5

PowerShell Cookbook: Your Complete Guide to Scripting the Ubiquitous Object-Based Shell

3
Scripting: Automation with Bash, PowerShell, and Python

Rating is 4.8 out of 5

Scripting: Automation with Bash, PowerShell, and Python

4
Learn PowerShell Scripting in a Month of Lunches

Rating is 4.7 out of 5

Learn PowerShell Scripting in a Month of Lunches

5
Mastering PowerShell Scripting - Fourth Edition: Automate and manage your environment using PowerShell 7.1

Rating is 4.6 out of 5

Mastering PowerShell Scripting - Fourth Edition: Automate and manage your environment using PowerShell 7.1

6
Practical Automation with PowerShell: Effective scripting from the console to the cloud

Rating is 4.5 out of 5

Practical Automation with PowerShell: Effective scripting from the console to the cloud

7
Mastering PowerShell Scripting - Fifth Edition: Automate repetitive tasks and simplify complex administrative tasks using PowerShell

Rating is 4.4 out of 5

Mastering PowerShell Scripting - Fifth Edition: Automate repetitive tasks and simplify complex administrative tasks using PowerShell

8
PowerShell for Sysadmins: Workflow Automation Made Easy

Rating is 4.3 out of 5

PowerShell for Sysadmins: Workflow Automation Made Easy

  • Book - powershell for sysadmins: workflow automation made easy
9
PowerShell Pocket Reference: Portable Help for PowerShell Scripters

Rating is 4.2 out of 5

PowerShell Pocket Reference: Portable Help for PowerShell Scripters


How to get the Java version using the Get-ItemProperty command in PowerShell?

To get the Java version using the Get-ItemProperty command in PowerShell, you can follow these steps:

  1. Open PowerShell by searching for it in the Start menu and clicking on it.
  2. Type the following command to get the Java version installed on your computer:
1
Get-ItemProperty "HKLM:\Software\JavaSoft\Java Development Kit\" | Select-Object -ExpandProperty CurrentVersion


This command will retrieve the Java version from the Windows registry and display it in the PowerShell window.

  1. Press Enter to run the command. The Java version installed on your computer will be displayed in the PowerShell window.


Note: This command will only work if Java is installed on your computer and the path to the Java Development Kit registry key is correct. If Java is not installed or the registry key path is different, you may need to modify the command accordingly.


How to get the current Java version in PowerShell script?

You can get the current Java version in a PowerShell script by using the following command:

1
(Get-Command java).FileVersionInfo.FileVersion


This command will return the current version of Java that is installed on your system.


How to check the Java version in PowerShell?

To check the Java version in PowerShell, you can use the java command with the -version option.


Open PowerShell and type the following command:

1
java -version


Press Enter, and you should see the Java version information displayed in the output. This will show you the installed Java version on your system.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

To open a PowerShell console window from an existing PowerShell session, you can use the Start-Process cmdlet with the -FilePath parameter to specify the path to the PowerShell executable (powershell.exe).Here is the command you can use: Start-Process powershe...
To run PowerShell in Command Prompt, you can simply type 'powershell' and press enter. This will open a new PowerShell window within the Command Prompt window. You can then start entering PowerShell commands as you normally would in a standalone PowerS...
To start a new PowerShell instance and run commands in it, you can simply open a PowerShell window by searching for it in the Start menu or by typing "powershell" in the Run dialog box (Windows key + R).Once the PowerShell window is open, you can start...