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

Simple Java Project not working #4847

Closed
FlorianKirmaier opened this issue Jan 11, 2023 · 7 comments
Closed

Simple Java Project not working #4847

FlorianKirmaier opened this issue Jan 11, 2023 · 7 comments
Labels
bug Something that is making a piece of functionality unusable java support Java support related tickets

Comments

@FlorianKirmaier
Copy link

Describe the bug

Actually, I was trying to create a sample project, for a more complicated bug, but then I noticed that my "minimal project" doesn't seem to work without any changes

https://github.com/JPro-one/HelloJPro.

Screenshot 2023-01-11 at 22 21 58

This is a pure Java project. The question is, is that supposed to work?
I'm asking because Metals it's a scala language server.

When I look into my other projects, the Java parts sometimes work with Metals/Bloop, and sometimes not.
But Metals/Bloop is always trying to compile it, so I guess it's in the scope of the project.
So, I thought I start by posting the most simple case as a bug report.

If you wonder why I post this, I usually have a lot of mixed Scala/Java projects.

Expected behavior

No response

Operating system

macOS

Editor/Extension

None

Version of Metals

v1.21.0

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Jan 12, 2023

Thanks for reporting! We do have a limited Java support and it should always compile correctly, so this might be soemthing that we need to take a look into.

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable java support Java support related tickets labels Jan 12, 2023
@FlorianKirmaier
Copy link
Author

Thanks for reporting! We do have a limited Java support and it should always compile correctly, so this might be soemthing that we need to take a look into.

Great to hear!
Tell me when you need further Infos.

@FlorianKirmaier
Copy link
Author

I've just retested it for the record, and I still have the same/similar problem on very basic Java-Projects.
Screenshot 2023-06-15 at 14 42 59
If I would guess, any Java projects with modules kind of fail.

@tgodzik
Copy link
Contributor

tgodzik commented Jun 15, 2023

Looks like we are missing javafx in the classpath. Currently, we need the Metals Java classpath to correspond to the one you need to use. Could you make sure that metals.javaHome is set to the proper Java home? You should be prompted to replace the Bloop configuration. You might also need to reimport the project, not sure.

Let me know if any of that helps you out!

@FlorianKirmaier
Copy link
Author

I've set the JavaHome, but it doesn't help.

Nowadays, JavaFX is usually (except for some weird JDK distributions) not part of the JDK.
We use JavaFX exclusively as a Library. It also doesn't find other libraries - so this is not limited to JavaFX.
It generally doesn't use the libraries - but according to the screenshot, it finds the library in the dependency.

I would guess that the java-compiler is somehow called wrongly.
Screenshot 2023-06-16 at 15 50 31

Screenshot 2023-06-16 at 15 49 13

@tgodzik
Copy link
Contributor

tgodzik commented Jun 20, 2023

Looks like the source of issues is module-info.java which isn't proeprly handled in Bloop. I am getting file should be on source path, or on patch path for module, not sure what that is about yet. I will try and transfer the issue to Bloop.

@FlorianKirmaier
Copy link
Author

Thank you!
This seems like the correct description of what is failing.
Guess it's also worth mentioning, that this is a Gradle project - so this might be a error specific on how Gradle is handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable java support Java support related tickets
Projects
Archived in project
Development

No branches or pull requests

2 participants