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

Unable to point to the JDK in a docker container #1841

Open
luukvhoudt opened this issue Mar 19, 2021 · 2 comments
Open

Unable to point to the JDK in a docker container #1841

luukvhoudt opened this issue Mar 19, 2021 · 2 comments

Comments

@luukvhoudt
Copy link

It might not be an issue because I think it's possible to configure this extension so it can the JDK binary's from a docker container. However I also see the possibility that there is some issue with the extension in the way it is facilitating the configuration of the JDK.

Please have a look at this Stack Overflow topic where we try to figure out how to configure the extension and docker container, to make them work together.

Environment
  • Operating System: Ubuntu 20.10
  • JDK version: 1.8
  • Visual Studio Code version: 1.54.3
  • Java extension version: 0.76.0
Steps To Reproduce
  1. Follow all the steps described in the Stack Overflow question until update release to marketplace #1 in a valid Java project.
Current Result

Errors, see stack overflow question.

Expected Result

A working Java Language Server and Java code being compiled.

Additional Information

The following issues might be related: #1801 and #1754

I was not able to get Java Language Server logs, I tried but got:

Command 'Java: Open Java Language Server Log File' resulted in an error (command 'java.open.serverLog' not found)

Attached files:

@luukvhoudt luukvhoudt changed the title Unable to setup point to a JDK in a docker container Unable to point to a JDK in a docker container Mar 19, 2021
@luukvhoudt luukvhoudt changed the title Unable to point to a JDK in a docker container Unable to point to the JDK in a docker container Mar 19, 2021
@fbricon
Copy link
Collaborator

fbricon commented Mar 19, 2021

You seem on the right track, except you need a JDK 11 (minimum) to run vscode-java. You can mount other volumes pointing to other JDKs if you need to compile a project with a particular version. See https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements#setting-the-jdk

@luukvhoudt
Copy link
Author

Thanks @fbricon you made me realize that there is a difference between the JDK version and the Java version, I kinda thought that it was the same thing. Thanks to this discovery I managed to make it work, however it's not really what I was hoping for.

Have a look at the answer I posted on the Stack Overflow topic. To summarize, I didn't really need to create a custom java binary what spins up a docker container with a JDK image. I managed to extract the JDK-files from the image and copy it to my OS its filesystem, where after I pointed the extension to it.

Not sure if the Stack Overflow answer closes this issue, because it doesn't really use the docker container. I'm quite sure it's possible because IntelliJ has this functionality available.

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

No branches or pull requests

3 participants