I have Java installed on my machine (the JRE is under C:\\Program Files\\Java) but I can\'t run any java command from the Windows PowerShell command prompt.
If the environment variable is set or you have sourced the environment appropriately, the issue is executing a file in a shell:
javac .\HelloWorld.java //That is a file, so it can be ./
java HelloWorld //Not the correct file name, so it will not execute, and so must call it as in MSDOS
You cannot .\ on the HelloWorld.class as the Java bytecode must be executed without the extension, .\ is for file execution.