For JAVA_HOME it should be C:\java, but on your Path variable, it should point to C:\java\bin\ since Path is what is used to tell the Command Prompt where to look for executables.
java adding to path
What are we actually doing when setting Environment path variable?
Automatically Updating the Java Path in the Environment Variables
%JAVA_HOME% and %Path% variables set correctly. Java returning wrong version.
Videos
In short, it provides a list of directories where executable files can be found without specifying the full-path to the binary.
If you open a command-line-interface on your machine, you can type many commands without having to specify the path to the program. i.e. fdisk, shutdown, ipconfig, nslookup, etc... Keep in mind, that there are also some built-in commands that are built into the command-line-interpreter that are not a separate program... like dir, echo, cls, etc...
The purpose the JRE/JDK wants to modify your PATH environment variable is simply to be able to type java at the command-line without having to specify the full path (i.e. "c:\Program Files (x86)\Java\jre1.8.0_211\bin\java.exe")
You can modify/view your own PATH environment variable by clicking on the search-bar in windows, and type in "edit the system environment variables".

There are actually 2 sets of environment variables, and they will get merged when you open the command prompt. The ones listed under "System variables" affect the whole system, and all users that log into that computer. The ones listed under "User variables for blahblah" only affect the currently logged in user.
Basically, the PATH it defines a set of directories on which programs will be searched for when only the program name is provided, instead of an absolute/relative path.
This is how the OS can find the right program to run when you only type "java" in the terminal, for instance.
Otherwise you would have to provide the full path, like "%JAVA_HOME%/bin/java".
what does adding java to path does on windows? I started a local java short course sometime ago but I had to differ it. I started watching some online tutorials but none of them added java "to path" (system properties ->Environment Variables -> click on path -> click edit -> click new paste (C:\Program Files\Java\jdk-17\bin) which I did in the local course I joined.
I am learning Java, and after installing the jdk, I had to set the PATH Environment Variable. In simple words, what am I actually doing?
I need to setup a task on a few machines with apps that require the correct Java version path in their environment variables.
This was suggested, but requires some work apparently:
Remove-PathFolders -Folders “\Java\jdk” -EnvironmentVariableTarget $([System.EnvironmentVariableTarget]::Machine) $jdkDp = (Get-ChildItem -Path “C:\Program Files (x86)\Java\jdk*” | Sort-Object name | Select-Object -Last 1).FullName Add-PathFolders -Folders $($jdkDp + "\bin") -EnvironmentVariableTarget $([System.EnvironmentVariableTarget]::Machine) Get-PathFolders -EnvironmentVariableTarget $([System.EnvironmentVariableTarget]::Machine)
Are you required to use PowerShell to accomplish this?
I’m not against it, I’m just curious.
It would be wise to backup your current path before executing the change.