简体   繁体   中英

how to change default java path

How can I change default java? Here is my java home directory;

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_05;

JRE_HOME=C:\Program Files\Java\jdk1.7.0_05\jre;

I also added "C:\\Program Files\\Java\\jdk1.7.0_05" directory to path variable.But the problem is when I type java -version from console the output is;

Error: could not open 'C:\Program Files\Java\jre7\lib\amd64\jvm.cfg'

"I also added "C:\\Program Files\\Java\\jdk1.7.0_05" directory to path variable."

Instead you should add %JAVA_HOME%\\bin and %JRE_HOME%\\bin to your path. See if that clears up the problem.

Note that you'll need to open a new command window before the changes will apply

Try these two things

REM First set JAVA_HOME
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_05
REM Add to the PATH.
set PATH=%JAVA_HOME%\bin;%PATH%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM