Skip to content

Can't run a groovy script in powershell (May apply to some java scripts as well) #1849

Open
@BillKress

Description

@BillKress

jbang version 0.117.1

If you run "jbang hello.groovy" in a powershell window you will see this error:

Error: Could not find or load main class .grape.enable=false
Caused by: java.lang.ClassNotFoundException: /grape/enable=false

The groovy script runner sets an option -Dgroovy.grape.enable=false to disable grape, however powershell treats the = specially.
I don't use other -D= options, but I assume they might cause problems as well.

I'm almost certain the same thing would happen if you passed a -D parameter to Java using the //JAVA-OPTIONS or //JAVAC-OPTIONS in Powershell.

I think the fix is to put quotes around any options containing equals signs when running in powershell.

Workaround? Use CMD or bash for now, but since windows is moving away from cmd towards powershell I expect you'll see this more often.

Great application, thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions