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.
>>> java -version
java : The term 'java' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ java
+ ~~~~
+ CategoryInfo : ObjectNotFound: (java:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
However, I have noticed that Java does work and that I can run Java commands on the old Windows command prompt. Turns out it's only PowerShell where I can't run those commands.
I have JRE 7 and I'm using Windows PowerShell on Windows 8.
The Java is not recognized as an internal or external command in Command Prompt error occurs if the environment variables are not configured correctly. By adding the correct path to an environment variable, you can resolve the issue. If the error persists, try installing the compatible Java version.
While there are many IDEs with built-in execution capabilities (Eclipse and IntelliJ for example), Java can also be run directly from the command line.
Add it to C:/Program Files/Java/jre7/bin
added to the classpath environment variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With