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.
Add it to C:/Program Files/Java/jre7/bin
added to the classpath environment variable.
If it works in cmd, but not in PowerShell, your JDK path entry might be in quotes.
As described in an answer to another question, go to system variables, edit the raw text of Path and simply remove the quotes.
Add the location of your java installation (the bin directory) to the PATH variable.
;%ProgramFiles%/Java/jre%version%/bin
followed by a ;
Note:
%version% means the java version.
If it works in the regular shell but not in PowerShell, maybe you had PowerShell open when you installed or set your path and you just need to close PowerShell and reopen a new one to pick up the new path.
You need to set the Java class path:
Reference:
How to set class path?
Or:
Link-2: How to set class path?
You need to modify your "PATH" environment variable to add your "java" bin location, one way
via command prompt
set path=%path%;<your java bin location>;
But this will be set only for your current session of your terminal.