jbang icon indicating copy to clipboard operation
jbang copied to clipboard

JBang interactive option fails with `Unknown option: D`

Open sberyozkin opened this issue 4 years ago • 4 comments

In Quarkus, after doing quarkus create cli --jbang and then moving to the generated code-with-quarkus and running jbang --interactive src/main.java reports:

[jbang] You can run the main class `io.quarkus.runner.GeneratedMain` using: userMain(args)
Unknown option: D

Note adding a package declaration to src/main.java makes no difference

sberyozkin avatar Jun 25 '21 12:06 sberyozkin

That's because the generated path uses jshell and it runs the following:

/home/ggastald/.sdkman/candidates/java/current/bin/jshell -Djava.util.logging.manager=org.jboss.logmanager.LogManager --class-path=/home/ggastald/.jbang/cache/jars/main.java.3ecc6e5945ddb5560d324568ec2caae63febafbf794206fbadf0ad4b82c8290c.jar:...

Which I think it is missing a -R or -J:

/home/ggastald/.sdkman/candidates/java/current/bin/jshell -R-Djava.util.logging.manager=org.jboss.logmanager.LogManager --class-path=/home/ggastald/.jbang/cache/jars/main.java.3ecc6e5945ddb5560d324568ec2caae63febafbf794206fbadf0ad4b82c8290c.jar:...

gastaldi avatar Jul 02 '21 01:07 gastaldi

BTW removing the flag or putting the -R or -J prefix still fails the execution with:

Error:
package io.quarkus does not exist
int userMain(String[] args) { return io.quarkus.runner.GeneratedMain(args);}
                                     ^---------------^
|  Welcome to JShell -- Version 11.0.11
|  For an introduction type: /help intro

jshell> 

gastaldi avatar Jul 02 '21 01:07 gastaldi

Is it missing users own jar ?

Btw. Even when we fix that we don't have a way to run quarkus non-blocking / in background so you can interact with it from jshell.

@stuartwdouglas you see a way to run quarkus in background and be able to interact with it from jshell ?

maxandersen avatar Jul 02 '21 06:07 maxandersen

just saw https://github.com/bitterfox/JavaFXSupportsForJShell which use --execution flag on jshell to allow executoin on jfx thread....could be interesting to explore for quarkus too

maxandersen avatar Oct 31 '21 14:10 maxandersen