Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--enable-preview #161

Closed
axieax opened this issue Oct 25, 2021 · 6 comments · Fixed by #165
Closed

--enable-preview #161

axieax opened this issue Oct 25, 2021 · 6 comments · Fixed by #165

Comments

@axieax
Copy link

axieax commented Oct 25, 2021

LSP client configuration

https://github.com/axieax/dotconfig/blob/main/nvim/lua/lsp/utils.lua#L22-L80

Eclipse.jdt.ls version

latest

Steps to Reproduce

Empty Java project with no config files
:Telescope dap configurations
Select main class
Error appears when run

Expected Result

Running dap configurations successfully brings up the main classes - where selecting one would normally work.

Actual Result

For some of my Java projects, the main functions cannot be run with DAP properly due to the missing --enable-preview argument (barebones Java repo with no config file - works fine in VSCode).

Error: LinkageError occurred while loading main class random.Game
        java.lang.UnsupportedClassVersionError:
Preview features are not enabled for random/Game (classfile version 61.65535). Try running with '--enable-preview'

[Process exited 1]
@mfussenegger
Copy link
Owner

For some of my Java projects, the main functions cannot be run with DAP properly due to the missing --enable-preview argument (barebones Java repo with no config file - works fine in VSCode).

Not sure I follow. Does the project use preview features?

@axieax
Copy link
Author

axieax commented Oct 27, 2021

I don't think so, but it seemed to compile with --enable-preview by default, so it's expected to run with --enable-preview as well.

@mfussenegger
Copy link
Owner

but it seemed to compile with --enable-preview by default

This would have to be configured in the project configuration.

Do you have a sample project where I can reproduce this?

@axieax
Copy link
Author

axieax commented Oct 29, 2021

Sure! In VSCode, create a new sample Java project

  1. Command > Java: Create Java Project
  2. Select No Build Tools

Navigating to the default App.java with VSCode, the main function can be run by selecting "run".

Navigating to the same App.java with Neovim and trying to run it with Dap Configurations (which automatically detects it), will result in the --enable-preview message from before.

Hope this helps! I'm not too sure how to configure it in the project configuration.

@mfussenegger
Copy link
Owner

Can you try with #165 ?

@axieax
Copy link
Author

axieax commented Oct 29, 2021

Works like a charm 😁 appreciate the quick fix!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants