jdtls 2.0 KB

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