jdtls 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC2116
  3. # NOTE:
  4. # This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead
  5. #
  6. # NOTE:
  7. # If you're not using Linux you'll need to adjust the `-configuration` option
  8. # to point to the `config_mac' or `config_win` folders depending on your system.
  9. OS="$(uname -s)"
  10. case "$OS" in
  11. Linux)
  12. CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_linux"
  13. ;;
  14. Darwin)
  15. CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_mac"
  16. ;;
  17. esac
  18. # Determine the Java command to use to start the JVM.
  19. if [ -n "$JAVA_HOME" ]; then
  20. if [ -x "$JAVA_HOME/jre/sh/java" ]; then
  21. # IBM's JDK on AIX uses strange locations for the executables
  22. JAVACMD="$JAVA_HOME/jre/sh/java"
  23. else
  24. JAVACMD="$JAVA_HOME/bin/java"
  25. fi
  26. if [ ! -x "$JAVACMD" ]; then
  27. die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
  28. Please set the JAVA_HOME variable in your environment to match the
  29. location of your Java installation."
  30. fi
  31. else
  32. JAVACMD="java"
  33. command -v java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  34. Please set the JAVA_HOME variable in your environment to match the
  35. location of your Java installation."
  36. fi
  37. # JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
  38. JAR="$HOME/.local/share/nvim/lspinstall/java/plugins/org.eclipse.equinox.launcher_*.jar"
  39. GRADLE_HOME=$HOME/gradle "$JAVACMD" \
  40. -Declipse.application=org.eclipse.jdt.ls.core.id1 \
  41. -Dosgi.bundles.defaultStartLevel=4 \
  42. -Declipse.product=org.eclipse.jdt.ls.core.product \
  43. -Dlog.protocol=true \
  44. -Dlog.level=ALL \
  45. -javaagent:"$HOME/.local/share/nvim/lspinstall/java/lombok.jar" \
  46. -Xms1g \
  47. -Xmx2G \
  48. -jar "$(echo "$JAR")" \
  49. -configuration "$CONFIG" \
  50. -data "${1:-$HOME/workspace}" \
  51. --add-modules=ALL-SYSTEM \
  52. --add-opens java.base/java.util=ALL-UNNAMED \
  53. --add-opens java.base/java.lang=ALL-UNNAMED
  54. # for older java versions if you wanna use lombok
  55. # -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \
  56. # -javaagent:/usr/local/share/lombok/lombok.jar \