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

Add option to enable easy java module path loading #3188

Open
bjornregnell opened this issue Sep 19, 2024 · 0 comments
Open

Add option to enable easy java module path loading #3188

bjornregnell opened this issue Sep 19, 2024 · 0 comments
Labels
enhancement New feature or request jvm Issues tied to the JVM platform

Comments

@bjornregnell
Copy link
Contributor

Is your feature request related to a problem? Please describe.
From Java 16 it is deprecated to load java modules from the class path. If you do you will get a warning that I guess eventually will be an error.

Describe the solution you'd like
An option to make relative paths to modules loadable in accordance with the new java module system. We need a nicer UX than the alternative described below.

Describe alternatives you've considered
A workaround may be to use something similar to

//> using javacOpt --module-source-path /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/hello-java-fx/.scala-build/hello-java-fx_c5fe86d8db/classes/main
//> using javaOpt --module-path /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/hello-java-fx/javafx-sdk-22.0.2/lib --add-modules javafx.controls

The example above is from a Discord discussion here: https://discord.com/channels/632150470000902164/901153021638082660/1286265411385425981

This is ugly as the path is hard-coded into the build and will not work if the repo is cloned elsewhere etc.

Additional context
This is relevant for e.g. JavaFX and I have a minimal JavaFX app here that needs this:
https://github.com/bjornregnell/minimal-scala-with-javafx
and at the time of writing it produces this warning:

"Unsupported JavaFX configuration: classes were loaded from unnamed module ..."

More details on the warning here:
https://stackoverflow.com/questions/67854139
scala/scala-dev#529
https://users.scala-lang.org/t/scala-jdk-11-and-jpms/6102/33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jvm Issues tied to the JVM platform
Projects
None yet
Development

No branches or pull requests

2 participants