# with-java
command wrapper around a new environment with `JAVA_HOME` and `PATH` overriden depending on the current profile. multiple profiles can be set with `with-java add <name> <path>`.
# usage
## add
```
with-java add java11 /usr/lib/jvm/java-11-openjdk
```
## remove
```
with-java remove java11
```
## list
```
$ with-java list
java17: /home/arisunz/.jdks/corretto-17.0.9
java11: /home/arisunz/.jdks/corretto-11.0.21
java21: /home/arisunz/.jdks/openjdk-21.0.1
```
## do
```
$ java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)
$ with-java do java11 java -version
openjdk version "11.0.21" 2023-10-17 LTS
OpenJDK Runtime Environment Corretto-11.0.21.9.1 (build 11.0.21+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.21.9.1 (build 11.0.21+9-LTS, mixed mode)
$ with-java do java11 mvn -version
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /opt/maven
Java version: 11.0.21, vendor: Amazon.com Inc., runtime: /home/arisunz/.jdks/corretto-11.0.21
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.6.7-arch1-1", arch: "amd64", family: "unix"
```
# license
© Ariela Wenner, 2023
unless otherwise specified, all sources here are licensed under the GNU GPL v3. See [COPYING.md](COPYING.md) for details.