LunarVim/utils/bin/jdtls

63 lines
2 KiB
Text
Raw Normal View History

2021-03-16 05:16:57 +01:00
#!/usr/bin/env bash
# NOTE:
# This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead
#
# NOTE:
# If you're not using Linux you'll need to adjust the `-configuration` option
# to point to the `config_mac' or `config_win` folders depending on your system.
case Darwin in
Linux)
2021-11-19 05:01:09 +01:00
CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_linux"
;;
Darwin)
2021-11-19 05:01:09 +01:00
CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_mac"
;;
2021-07-09 07:37:03 +02:00
esac
# Determine the Java command to use to start the JVM.
2021-07-19 18:20:54 +02:00
if [ -n "$JAVA_HOME" ]; then
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ]; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
2021-07-09 07:37:03 +02:00
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
2021-07-09 07:37:03 +02:00
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
2021-07-09 07:37:03 +02:00
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
2021-11-19 05:01:09 +01:00
JAR="$HOME/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"
2021-07-20 04:50:07 +02:00
GRADLE_HOME=$HOME/gradle "$JAVACMD" \
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product \
-Dlog.protocol=true \
-Dlog.level=ALL \
2021-11-19 05:01:09 +01:00
-javaagent:$HOME/.local/share/nvim/lsp_servers/jdtls/lombok.jar \
-Xms1g \
-Xmx2G \
-jar $(echo "$JAR") \
-configuration "$CONFIG" \
-data "${1:-$HOME/workspace}" \
--add-modules=ALL-SYSTEM \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED
2021-07-19 18:20:54 +02:00
# for older java versions if you wanna use lombok
# -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \
# -javaagent:/usr/local/share/lombok/lombok.jar \