java - Windows environment variable resolution error -


i trying put java jdk path windows path environment variable.

i changed/inserted appropriate variables , got command javac working yesterday, when tried same thing today, getting command not recognized error.

here values of relevant variables (on fresh cmd instance):

>> echo %java_home% java_home=c:\program files\java\jdk1.8.0_101  >> echo %path% c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;%java_home%\bin;c:\users\anmol\appdata\local\programs\python\python35\scripts\;c:\users\anmol\appdata\local\programs\python\python35\;c:\users\anmol\appdata\local\programs\python\launcher\  

i tried avoid spaces present in 'program files' writing java_home=c:\progra~1\java\jdk1.8.0_101, error persisted.

also, if open cmd , type set path=%java_home%\bin;%path% , in same session type javac, recognized correctly.

can tell going on , how set path correctly?

you have modified path set command, applies changes current terminal. make persistent system wide setting, use setx instead.

you'll need both, path , java_home in system environment.

note ` not modify current terminal's environment settings:

note: 1) setx writes variables master environment in registry.        2) on local system, variables created or modified tool          available in future command windows not in          current cmd.exe command window. 

what has happened in case? have set path environment variable @ time java_home not known yet. in case, %java_home% becomes part of path literally. following example demonstrates that:

c:\>set x=%a%  c:\>set a=something  c:\>set x x=%a%  c:\>set b=something  c:\>set x=%b%  c:\>set x x=something 

to fix it, set java_home using setx, close terminal , open new one. use setx set path, close terminal , open new one.

or

set java_home using setx, set java_home using set update console. use setx set path, close terminal , open new one.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -