Cannot run Java from the Windows PowerShell command prompt Cannot run Java from the Windows PowerShell command prompt powershell powershell

Cannot run Java from the Windows PowerShell command prompt


  • In the run dialog box, enter sysdm.cpl
  • In the window that came up, navigate to Advanced tab. Click on the Environment Variables button.
  • 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.


Make 2 environment variable changes:

  1. Add a JAVA_HOME variable equal to something like: C:\Java\JDK1.7.0_25_x64
  2. Add %JAVA_HOME%\bin to the beginning of your PATH variable.

Then, start a brand new shell to see if the changes were applied.


You need to modify your "PATH" environment variable to add your "java" bin location, one wayvia command promptset path=%path%;<your java bin location>;

But this will be set only for your current session of your terminal.