Java not recognized on PowerShell

前端 未结 3 1037
梦谈多话
梦谈多话 2021-01-19 01:36

I\'m using PowerShell on Windows 2012 server, and I deleted all the java commands from System32, reinstalled jdk, set JAVA_HOME and Path to point at the new installation. An

3条回答
  •  伪装坚强ぢ
    2021-01-19 02:25

    1) My default JAVA_HOME is:

    echo %JAVA_HOME%
    D:\Program Files\Java\jdk1.7.0_25
    <= The installer automagically configures this when you install a JRE
    

    2) My default %PATH% does not include any Java

    3) I'm able to run (but not compile) Java from a Windows command prompt:

    java -version
    java version "1.7.0_51"
    Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
    

    4) I'm also able to do exactly the same from inside Powershell (or from a .ps1 Powershell script):

    PS D:\temp> java -version
    java version "1.7.0_51"
    Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
    

提交回复
热议问题