windows中使用jenv管理java多版本
使用管理员模式打开
-
git clone github.com/FelixSelter…
-
将这个目录添加的环境变量,方便命令行执行jenv.bat
-
命令行执行jenv,会提示需要管理员权限将jenv.bat所在的目录放在PATH最前边
-
jenv不会自动下载所需要的java,仅仅是对本地版本的管理,先添加:
jenv add <name> <path>
-
通过name使用java版本:
jenv use <name>
-
通过
java -version
验证
jenv local xxx可以为某个目录自动设置某个java版本,没有真正的切换版本,这个设计和其他的多版本管理软件非常不同,非常好的设计
jenv存在一个问题,只能根据目录配置,不能全局切换
C:\Users\Administrator\Desktop>jenv -h
"jenv list" List all registered Java-Envs.
"jenv add <name> <path>" Adds a new Java-Version to JEnv which can be refferenced by the given name
"jenv remove <name>" Removes the specified Java-Version from JEnv
"jenv change <name>" Applys the given Java-Version globaly for all restarted shells and this one
"jenv use <name>" Applys the given Java-Version locally for the current shell
"jenv local <name>" Will use the given Java-Version whenever in this folder. Will set the Java-version for all subfolders as well
"jenv link <executable>" Creates shortcuts for executables inside JAVA_HOME. For example "javac"
"jenv uninstall <name>" Deletes JEnv and restores the specified java version to the system. You may keep your config file
"jenv autoscan [--yes|-y] ?<path>?" Will scan the given path for java installations and ask to add them to JEnv. Path is optional and "--yes|-y" accepts defaults.