Manage your Java environment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.0 KiB

#!/usr/bin/env bash
#
# Summary: Set or show the local application-specific JVM options
#
# Usage: jenv local-options <jvm options>
# jenv local-options --unset
#
# Sets the local application-specific JVM Options by writing the
# options to a file named `.java-options'.
#
# When you run a Java command, jenv will look for a `.java-options'
# file in the current directory and each parent directory. If no such
# file is found in the tree, jenv will use the global Java Options
# specified with `jenv global'. A version specified with the
# `JENV_JAVAOPT' environment variable takes precedence over local
# and global versions.
#
set -e
[ -n "$JENV_DEBUG" ] && set -x
# Provide jenv completions
if [ "$1" = "--complete" ]; then
echo --unset
exit
fi
JENV_JAVAOPT="$@"
if [ "$JENV_JAVAOPT" = "--unset" ]; then
rm -f .java-options
elif [ -n "$JENV_JAVAOPT" ]; then
jenv-options-file-write .java-options "$JENV_JAVAOPT"
else
jenv-options-file-read .java-options ||
{ echo "jenv: no local JVM options configured for this directory"
exit 1
} >&2
fi