From b0e44df12e37c9726f1f9f95c3d259358ff889c8 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 8 Feb 2018 10:37:25 -0600 Subject: [PATCH] Add List The Available JDKs as a unix til --- README.md | 3 ++- unix/list-the-available-jdks.md | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 unix/list-the-available-jdks.md diff --git a/README.md b/README.md index 16a9012..3503df1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_607 TILs and counting..._ +_608 TILs and counting..._ --- @@ -559,6 +559,7 @@ _607 TILs and counting..._ - [List Names Of Files With Matches](unix/list-names-of-files-with-matches.md) - [List Of Sessions To A Machine](unix/list-of-sessions-to-a-machine.md) - [List Parent pid With ps](unix/list-parent-pid-with-ps.md) +- [List The Available JDKs](unix/list-the-available-jdks.md) - [Map A Domain To localhost](unix/map-a-domain-to-localhost.md) - [Only Show The Matches](unix/only-show-the-matches.md) - [Open The Current Command In An Editor](unix/open-the-current-command-in-an-editor.md) diff --git a/unix/list-the-available-jdks.md b/unix/list-the-available-jdks.md new file mode 100644 index 0000000..e8f0d96 --- /dev/null +++ b/unix/list-the-available-jdks.md @@ -0,0 +1,17 @@ +# List The Available JDKs + +Want to know what JDK versions are installed and available on your machine? +There is a command for that. + +```bash +$ /usr/libexec/java_home -V +Matching Java Virtual Machines (3): + 9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home + 1.8.0_162, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home + 1.8.0_161, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home + +/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home +``` + +The listed VMs show what JDK versions you have and the final line shows +which is currently the default version.