Open objektwerks opened 1 year ago
Thanks for reporting! The current workaround is to use launch.json if using VS Code (other editors should also enable this in different ways) and defined jvm propeties there.
@tgodzik Okay, I created the following ./.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "scala",
"request": "launch",
"name": "Chuck Norris App",
"mainClass": "objektwerks.ChuckNorrisApp",
"args": [],
"jvmOptions": ["--enable-preview", "--add-modules=jdk.incubator.concurrent"],
"env": {}
}
]
}
I then selected the run link in the objektwerks.ChuckNorrisApp source file --- but VSCode failed to pick up the specified jvm options. I also tried a few other variations on the jvmOptions, but nothing worked.
The reported error is:
Exception in thread "main" java.lang.ExceptionInInitializerError
at objektwerks.ChuckNorrisApp.main(ChuckNorrisApp.scala)
Caused by: java.lang.UnsupportedOperationException: Preview Features not enabled, need to run with --enable-preview
at java.base/jdk.internal.misc.PreviewFeatures.ensureEnabled(PreviewFeatures.java:49)
at java.base/java.lang.Thread.ofVirtual(Thread.java:833)
at java.base/java.util.concurrent.Executors.newVirtualThreadPerTaskExecutor(Executors.java:274)
at objektwerks.ChuckNorrisApp$.<clinit>(ChuckNorrisApp.scala:11)
Have you or someone you know successfully used this technique? Thanks!
You need to run from the run menu. There is a drop-down to choose which configuration you want to run. You should see the created configuration name. I am on my phone now, but let me know if you have any issues. I will try to show a gif when I am on my computer
@tgodzik Indeed, selecting menu Run > Run Without Debugging works! :) The embedded run | debug source link does not. Thanks! ;)
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
When selecting run or debug in a runnable Scala source file, a local .jvmopts file should also be processed.
Describe alternatives you've considered
N/A
Additional context
If desired this project can be used to test the current and future state of the run | debug feature: https://github.com/objektwerks/scalafx.http
Search terms
.jvmopts run debug metals