Do I need to restart my system after setting JAVA in system environment's path variable?

后端 未结 7 1003
不知归路
不知归路 2020-12-14 09:21

I did the following steps but java does not seem to be working for me, do I need to restart my system if yes then why?

1. Right click My Computer->Advence         


        
7条回答
  •  伪装坚强ぢ
    2020-12-14 09:39

    You should set two things:

    1. JAVA_HOME
    2. PATH

    The first lies under the "User variables for [your user name]" section. Add the JAVA_HOME variable and set it to where your jdk is installed. i.e. C:\Program Files\Java\jdk1.7.0_51\

    The second lies under the "System variables" section. You should find the "path" variable, and edit it. Then, append ";%JAVA_HOME%\bin" (minus the quotes) to the end of the path variable.

    After you have done this, save the variables and close that window clicking the "ok" button. Close down all instances of the command prompt (and any IDE you may be developing with such as Eclipse or NetBeans), and reopen one command prompt. Then, if you would like to test whether or not your changes worked and are in effect, try the following:

    echo %JAVA_HOME%
    

    This should output where you set your java home variable to.

    echo %PATH%
    

    At the end of what is output, you should see your java home\bin addition to the path variable

    java -version
    

    If you can run this command from the command line, it means that your environment was set up correctly and java is now in your path.

提交回复
热议问题