You can modify the Java installation directory on line 3rd to set Java_home, ClassPath, and append to the front of the path.
Java_home=c:\program files\java\jdk1.6.0_10
Classpath=%java_home%\lib\tools.jar;%java_home%\lib\dt.jar;.
Path=%java_home%\bin; ....... Append to the top of the path (solve the problem where you should end up with a semicolon.) hehe. Leave the question to others
Here you can download http://download.csdn.net/detail/lpy3654321/5887509
If you have any questions, please leave a message.
@echo off set regpath=hkey_local_machine\system\currentcontrolset\control\session manager\environment set Javahome=C
: \program Files\java\jdk1.6.0_10 Rem lpy Echo. Echo ************************************************************ Echo * * echo * JDK system environment variable settings * echo *
* Echo ************************************************************ Echo. echo = = Prepare to set environment variable: java_home=%javahome% echo = = Note: If Java_home exists, will be overwritten, this operation is not reversible, please check the confirmation carefully!!
= = = Echo.
echo = = Prepare to set environment variable (there is a.): Classpath=%%java_home%%\lib\tools.jar;%%java_home%%\lib\dt.jar; echo = = Note: If classpath exists, will be overwritten, this operation is irreversible, please check the confirmation carefully!!
= = = Echo.
echo = = Prepare to set environment variable: path=%%java_home%%\bin echo = = Note: PATH is appended to the front, echo.
set/p en= Please confirm and press ENTER to start setting!
Echo.
Echo.
Echo.
Echo.
echo = = new Create environment variable java_home=%javahome% setx "Java_home" "%javahome%"-M echo.
Echo. echo = = new Create environment variable Classpath=%%java_home%%\lib\tools.Jar;%%java_home%%%\lib\dt.jar;.
Setx "ClassPath" "%%java_home%%\lib\tools.jar;%%java_home%%%\lib\dt.jar;"-M-echo.
Echo. echo = = new APPEND environment variable (append to front) path=%%java_home%%\bin for/f "tokens=1,* delims=:"%%a in (' Reg QUERY '%regpath% "/V" PATH ") do
(Set "L=%%a" set "P=%%b") set "y=%l:~-1%:%p%" Setx Path "%%java_home%%\bin;%y%"-M echo.
Echo.
REM lpy Zeus http://write.blog.csdn.net/postedit/9822439 echo = = Please press any key to exit! Pause>nul
@@