diff --git a/README.md b/README.md index bdf6240..1f78a98 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ If you don't have and don't want to have this in your project's pom, you can also do this: ```sh -echo 7 > .java-version +jvm local 7 ``` On OSX, jvm will use the `java_home` tool to find the available versions. For diff --git a/jvm.sh b/jvm.sh index 7ab3e4d..838a0cb 100755 --- a/jvm.sh +++ b/jvm.sh @@ -29,6 +29,21 @@ _jvm-discover-and-set() { [ ! -z "$version" ] && _jvm_set-java-path "$version" } +jvm() { + if [ "$#" != 0 ]; then + local command="$1"; shift + fi + case "$command" in + local) + echo "$@" > .java-version + ;; + *) + echo "Usage: jvm (local) " + return 0 + ;; + esac +} + if [ ! -z "$BASH" ]; then PROMPT_COMMAND=_jvm-discover-and-set elif [ ! -z "$ZSH_NAME" ]; then