javafx-gradle-plugin icon indicating copy to clipboard operation
javafx-gradle-plugin copied to clipboard

JVMArgs (and potentially other options) ignored when running via jfxRun

Open marckaraujo opened this issue 7 years ago • 14 comments

Hey @FibreFoX ,

Thanks for the help with the last issue, got it working, not a problem with your plugin. I am using JVMArgs like this:

jvmArgs = ["-agentlib:TakipiAgent"]

But it doesnt work.

If I run java -agentlib:TakipiAgent -jar project.jar in prompt it works.

marckaraujo avatar Mar 23 '17 16:03 marckaraujo

Can you check what will generated inside the .cfg-file?

FibreFoX avatar Mar 23 '17 16:03 FibreFoX

No, .cfg file has been created.

marckaraujo avatar Mar 23 '17 16:03 marckaraujo

build/jfx/native/{appname}/app/ should contain it ....

FibreFoX avatar Mar 23 '17 16:03 FibreFoX

When I run jfxNative it create .cfg and works well.

[JVMOptions]
-agentlib:TakipiAgent

But with jfxRun, it doesnt work.

marckaraujo avatar Mar 23 '17 16:03 marckaraujo

:D i think i get it now ... this is not how that feature works ... that options are not appended while calling jfxRun

FibreFoX avatar Mar 23 '17 16:03 FibreFoX

This is half bug and other half feature, because "jfxRun" was only ment as some "stupid shorthand" for running the application. Thanks for finding this ;) and using the plugin

FibreFoX avatar Mar 23 '17 16:03 FibreFoX

Hi @marckaraujo , can you try to add your parameters to jfx.runJavaParameter ? That one is one string and ment for debugging (like jfxRun is itself). I have thought about this, but I don't feel good about adding that lists to jfxRun, as the only purpose was to add a convenient way for executing. As the jvmArgs are ment for the final result and native launcher, I don't feel good about this.

How do you think about this, and is runJavaParameter sufficient for you?

FibreFoX avatar Apr 02 '17 17:04 FibreFoX

Its doesnt work for me, because tapiki need to launch with jvmArgs since it will monitor the application and send crash logs, of course that the most critical part is when you send the application to real users, this feature just help for local debug. The software in question is https://www.overops.com/

marckaraujo avatar Apr 04 '17 14:04 marckaraujo

Have you tried this configuration?

jfx{
    // used for native launchers
    jvmArgs = [
        '-agentlib:TakipiAgent'
    ]
    // used for development via jfxRun-task
    runJavaParameter = '-agentlib:TakipiAgent'
}

FibreFoX avatar Apr 04 '17 14:04 FibreFoX

I am not using this software anymore, so I cant make the test again, sorry. You can close if you want. Thanks anyway.

marckaraujo avatar May 19 '17 01:05 marckaraujo

Possibly this should be a separate issue but I believe this underlying problem affects integration with IntelliJ IDEA.

When I tell IDEA to run with jfxRun task with debugging it runs the task correctly, but the debugger does not attach and breakpoints are not hit. I reported this to Jetbrains, and they suggest it's because the jfxRun task is ignoring JVM args passed through.

Is this likely? If so, it would be great to have a fix for this issue. Alternatively, can you suggest a way to debug JavaFX apps with your plugin and IDAE?

MartinEden avatar Aug 08 '17 15:08 MartinEden

@MartinEden the task jfxRun runs your application within its own java-process (I use ProcessBuilder for this), therefor I think this is a misunderstanding how the "debugging"-feature from your IDE is working.

The jfxRun was ment as a shortcut for the CLI-call, nothing more. This means that any JVM-args have to be set via runJavaParameter

FibreFoX avatar Aug 15 '17 16:08 FibreFoX

@MartinEden Have you find a way to pass JVM args when debugging with IDE using this gradle plugin? Seems that this doesnt work: https://stackoverflow.com/questions/25079244/how-to-pass-jvm-options-from-bootrun/26141841#26141841

mataide avatar Jan 06 '18 21:01 mataide

I've forgotten some of what was going on for me here but: I think I thought that the only way to run a Kotlin JavaFX app from IDEA was using the Gradle task. I think I then later found a way to directly invoke the debugger on my code without having to use jfxRun.

MartinEden avatar Jan 08 '18 11:01 MartinEden