Skip to content

Add option to enable easy java module path loading  #3188

Open
@bjornregnell

Description

@bjornregnell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjvmIssues tied to the JVM platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions