1. Batch Processing ProgramJava environment variables can be set automatically
@ Echo off
If exist % 1 \ bin \ java.exe (
If REM enters the correct java2sdk installation directory, it starts to set environment variables.
@ Setx java_home % 1
@ Setx PATH %; % java_home % \ bin
@ Setx classpath % ;.
@ Setx classpath %; % java_home % \ Lib \ tools. Jar
@ Setx classpath %; % java_home % \ Lib \ DT. Jar
@ Setx classpath %; % java_home % \ JRE \ Lib \ RT. Jar
@ Echo on
@ Echo Java 2 SDK environment parameters are set and exit normally.
) Else (
If "% 1" = ""(
If the installation directory is not provided by REM, exit after prompt
@ Echo on
@ ECHO does not provide the installation directory of java2sdk, and does not set anything. Now exit the environment variable settings.
) Else (
If REM provides a non-empty installation directory but does not have bin \ java.exe, the specified directory is the wrong directory.
@ Echo on
@ ECHO: the installation directory of the invalid java2sdk is not set. Now exit the environment variable settings.
)
)
------------------------------------------------------
2 cmd command settings
The command used to temporarily set environment variables in the command line:
Set Path = c: \ j2sdk1.4.0 \ bin