BAT Batch Set Java JDK system environment variable file __java

Source: Internet
Author: User
Tags prepare


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

@@


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.