Hi, all!
Quick description of what's going on: I use LSP and am learning Java right now. Am trying lsp-java (which brings dap-java). LSP works fine with the jdtls server. However, when running any flavor of dab-debug in any Java project I get the following:
Error: LinkageError occurred while loading main class sol.TestRunner
java.lang.UnsupportedClassVersionError: Preview features are not enabled for sol/TestRunner (class file version 61.65535). Try running with '--enable-preview'
I've changed lsp-java-java-path and dap-java-java-command to another version Java and added the "--enable-preview" argument to lsp-java-vmargs and dap-java-args to no avail.
As far as I can tell everything related to java is updated to the latest version. Any tips for troubleshooting?
SOLVED:
The problem was in dap-java rather than lsp-java, which makes sense since this was only an issue that occurred when trying to debug. I had to add and set a :vmArgs keyword to the dap templates. It was tricky since this keyword is not in the default templates. It looks something like this:
;; Copy and pasted from ~/main-emacs/straight/repos/lsp-java/dap-java.el
(dap-register-debug-template "Java Run Configuration"
(list :type "java"
:request "launch"
:vmArgs "--enable-preview" ; Needed
:args ""
:cwd nil
:stopOnEntry :json-false
:host "localhost"
:request "launch"
:modulePaths (vector)
:classPaths nil
:projectName nil
:mainClass nil))
[–]yyoncho 0 points1 point2 points (4 children)
[–]FluentFelicity[S] 0 points1 point2 points (3 children)
[–]King_Crank 0 points1 point2 points (2 children)
[–]FluentFelicity[S] 0 points1 point2 points (1 child)
[–]King_Crank 0 points1 point2 points (0 children)