kotlin-debug-adapter icon indicating copy to clipboard operation
kotlin-debug-adapter copied to clipboard

Pass launch arguments. Pass JVM -D??? args.

Open ru5t opened this issue 6 years ago • 4 comments

Triying do debug Dropwizard project. It supposed to be launched with command line args like this: java -jar ???.jar server config.yml. So when launched I need to pass args server config.yml. From launch.json sample I don't see how is it possible. Also looking at source I don't see it either.

Also sometimes there's need to pass jvm args like this -Dlogback.configurationFile=/path/to/logback.xml

How can it be done?

ru5t avatar Jun 18 '19 09:06 ru5t

Command line arguments are not yet supported.

To implement these, the launch configuration (on the VSCode side) would require the specificiation of an additional args property:

https://github.com/fwcd/KotlinDebugAdapter/blob/017929c84d624d8ac090a2bbe7ced2ed55b1e8bc/package.json#L65-L97

On the server side, the initialization method would have to be updated accordingly:

https://github.com/fwcd/KotlinDebugAdapter/blob/017929c84d624d8ac090a2bbe7ced2ed55b1e8bc/src/main/kotlin/fwcd/ktda/adapter/KotlinDebugAdapter.kt#L84-L104

fwcd avatar Jun 26 '19 17:06 fwcd

Is the args parameter in the launch method on the server side related to the args on launch.json configuration on the client side?

minkir014 avatar Jul 13 '19 19:07 minkir014

Should be fixed as of #41.

fwcd avatar Jun 30 '20 14:06 fwcd

I think this should be reopened. I don't believe #41 addresses @ru5t's original issue...

vmArguments get passed to the JVM and cannot be used to pass arguments to the Java application itself.

For example, following snippet will call java --foo [...] App which fails because java doesn't recognize the argument.

{
    // ...
    "mainClass": "App",
    "vmArguments": "--foo"
}

As a workaround, I am using

{
    // ...
    "mainClass": "App --foo",
}

which seems to work, as java passes --foo to the main method. Still, having support args is the solution.

philipbel avatar Jun 06 '24 14:06 philipbel