A micro Java environment switch which inspired by virtualenv
.
Linux and any other OS whose shell is bash or zsh.
Windows.
-
Linux
JDK(Oracle JDK) should be placed on a folder whose name is
java
and its name should startswithjdk
.exp:
/opt/java/jdk-9
,/opt/java/jdk1.8.0_144
-
Windows
Just use the default installation directory of
Oracle JDK
-
Other
you can run the jvirtualenv in the parent directory of JDK.
Or edit the config file directly. (not recommented)
The config file should be as followed:
[ { "tag": "14.0:2:64", "version": "14.0.2", "bit": "64", "home": "/opt/java/jdk-9" }, { "tag": "1:8:0:32", "version": "1.8.0_144", "bit": "32", "home": "/opt/java/jdk1.8.0_144" } ]
pip3 install jvirtualenv
jvirtualenv list-tag
(view all jdk tag)jvirtualenv -j 1.8 <myproject>
(if 1.8 is prefix of someone tag)source <myproject>/bin/activate
or<myproject>\\bin\\activate.bat
(windows cmd) (activate virtual java env)deactivate
or<myproject>\\bin\\deactivate.bat
(deactivate the virtualenv)
FOR EXCELLENT PYTHON3 AND VIRTUALENV!