krasa / VisualVMLauncher

IntelliJ plugin - https://plugins.jetbrains.com/plugin/7115
Apache License 2.0
107 stars 19 forks source link

Icons are greyed out. #14

Open roberterdin opened 9 years ago

roberterdin commented 9 years ago

The VisualVM icons are greyed out. I specified the executable (/usr/lib/jvm/java-8-oracle/bin/jvisualvm, that is on Ubuntu) but nothing happens. I can run the VisualVM from the terminal without problems.

Any ideas where to start troubleshooting?

IDEA version: 14.1

krasa commented 9 years ago

there is only this condition:

    public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
        return executorId.equals(RunVisualVMExecutor.RUN_WITH_VISUAL_VM)
                && profile instanceof ModuleRunProfile
                && !(profile instanceof RemoteConfiguration);
    }

What kind of Run Configuration are you using?

roberterdin commented 9 years ago

I execute a gradle task as Run Configuration: cleanTest test --tests SomeTest

I guess I need a JAR Applicatoin?

krasa commented 9 years ago

Yep, JUnit/TestNG/Application...

I will look into it, but not even YourKit buttons are enabled for gradle...

roberterdin commented 9 years ago

Ok thank you. Don't worry too much about Gradle support... if somebedy wants to profile something he will manage to make an according Run Configuration :)

krasa commented 9 years ago

I just tried it, and it does not seem possible without some heavy hacks, since Gradle uses deamons.

roberterdin commented 9 years ago

At least for Unit Tests, yes. AFAIK (have not veryfied this) it starts the application without a daemon.

krasa commented 9 years ago
task execute(type:JavaExec) {
    main = mainClass
    classpath = sourceSets.main.runtimeClasspath
}

this uses the deamon too.

It is possible to run it as a Groovy task, then it will run in its own process with the visualvm.id correctly set and with working buttons, however that is a wrapper too (org.gradle.launcher.GradleMain) and forks another process in which the app is running, and it cannot be debugged this way - Maven does something similar and the process forking can be disabled, so perhaps this too can be configured...

There must be some way how to pass a VM parameter via the deamon to the forked processes...

roberterdin commented 9 years ago

The gradle run task from the Application Plugin runs my application in a seperate process. It sais it uses the JavaExec function. This function also takes VM args.

Example:

// File: build.gradle
apply plugin: 'java'

task(runSimple, dependsOn: 'classes', type: JavaExec) {
    main = 'com.mrhaki.java.Simple'
    classpath = sourceSets.main.runtimeClasspath
    args 'mrhaki'
    jvmArgs "-DsomeArg=xx", "-Danother=yy"
    systemProperty 'simple.message', 'Hello '
}

Source: http://mrhaki.blogspot.com/2010/09/gradle-goodness-run-java-application.html

edit: did not read your answer correctly, discard what I just wrote

IngeniousTom commented 2 years ago

I have the same issue! After I installed and configured Visual VM Launcher and restarted the Intellij IDEA 2021.3.3 I can see that icons are greyed out as shown on the screenshot below.

VisualVM Launcer

Icons are also greyed out even in "Run" menu as you can see on the screenshot below:

VisualVM Launcer2

-My project uses the same jdk as shown in the plugin configuration; -My project starts with gradle task (look at the screenshot below).

gradle_run_debug

Can you help me with this problem?

igorwojda commented 1 year ago

@krasa I think I have found the root cause of this problem - it is all about configuration type:

Icons are grayed out for Gradle configurations: image

Icons are active for JUnit configurations: image

You can also observe similar behavior when launching tests from IntelliJ IDEA

No Icons for Gradle configurations: image

Icons are visible for JUnit configurations: image

Action It looks like this Plugin needs some changes because the Gradle configuration is the default way of running tests nowadays: image

Changing Default test configuration This option allows us to determine which configuration will be created while running tests from the IntelliJ IDEA.

image