oracle / visualvm

VisualVM is an All-in-One Java Troubleshooting Tool
https://visualvm.github.io/
Other
2.86k stars 300 forks source link

VisualVM does not start if JRE is inside JDK folder (/jre) #540

Open SDXC opened 9 months ago

SDXC commented 9 months ago

Describe the bug We have some use-cases where we install JRE along JDK (mainly to minimize the usage of JDK where it is not needed). We do, however, bundle JRE inside the JDK folder (same version) so it's a bit easier to maintain and looks more clean. This has been a proven and so far stable installation method and only with VisualVM we have an issue in this case upon startup.

When trying to start VisualVM the following error occurs: "You are running VisualVM using Java Runtime Environment (JRE)." Also showing the "Location" pointing to the /jre folder inside our JDK.

It looks like the implemented runtime check automatically assumes that an existing /jre folder means we're using JRE. We use the parameter --jdkhome "%JDK_HOME%" (without trailing ).

To Reproduce Steps to reproduce the behavior:

  1. Put a JRE inside the JAVA_HOME folder and rename it to "jre"
  2. Start VisualVM with --jdkhome "%JDK_HOME%" or --jdkhome "%JAVA_HOME%"
  3. The error occurs.
  4. Remove the jre folder and try again. It works now.

Expected behavior It is nice to have a check for JRE if you're actually using the wrong package. But it should also take into account what's actually in the bin folder and not what "might" be in the jre folder. As we're exactly pointing to the --jdkhome any unnecessary subfolders should be ignored.

VisualVM log N/A

Screenshots grafik

Desktop (please complete the following information):