You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Application cannot find Java 1.8 or higher. But Java 1.8 and Java 10 are installed on the computer. JAVA_HOME env. variable is set to the right value too.
Desktop (please complete the following information):
OS: Windows 10 x64 (up to date)
JDK version 1.8.0_181-1-ojdkbuild
Reacted by Reto Merz, Martin Misiarz, Lars Behnke, Tarek Eldeeb, egerardus, Ihor Taranenko, Igor Manushin, noritersand, Frank Huo, Vojtěch Krása and 29 more
Using --jdkhome parameter works ! VisualVM start with success
Reacted by zouyq, aniketchopade, Jirka Pinkas, Tarek Eldeeb, egerardus, Roman Roshchin, muhilan, Ihor Taranenko, Jay Ehsaniara, Daniel Huhn and 14 more
Why doesn't VisualVM just use the the JAVA_HOME environment variable to find Java?
Reacted by Thibault Meyer, Martin Misiarz, A. Bos, ds58, André Barranco, Mikołaj Kania, Dietrich Schulten, Cai.MY, zouyq, mprowaznik and 100 more
Reacted by Mikołaj Kania, Piotr Marcińczyk, Manuel Jordan Elera, Valerij Dobler, Dmitry Zavodnikov, Bohdan Belokur, Tau, magicwerk, Alexey Markevich and Robert Müller
The problem appears to have come back, I am using adoptopenjdk 11. even if I use --jdkhome, it still can't find it, even with Visual VM2 on Windows 10.
EDIT: Nevermind, solved problem, by using '/' for system paths instead of '' on Windows, then --jdkhome recognized adoptopenjdk 11, thanks.
Reacted by Pavitra Golchha, Owenn, Tomek Niedźwiedź, maartyl, Markus KARG, Frankwayne, Lu Ma and David Garland
Do you mean you had to use visualvm.exe --jdkhome C:/Path/To/<JDK_HOME> instead of visualvm.exe --jdkhome C:\Path\To\<JDK_HOME> on Windows? Please provide the full command to start VisualVM on your setup to make it clear for us.
Reacted by Pavitra Golchha, Dmitry Zavodnikov, Frankwayne, Clark and Santiago Cabrera Marin
Do you mean you had to use visualvm.exe --jdkhome C:/Path/To/<JDK_HOME> instead of visualvm.exe --jdkhome C:\Path\To\<JDK_HOME> on Windows? Please provide the full command to start VisualVM on your setup to make it clear for us.
Tested on a fresh Windows 10 installation, VisualVM 2.0 and AdoptOpenJDK 11.0.6.
Using the Windows installer, default settings, the JDK is installed to C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot, and the Windows registry is NOT updated with the JavaSoft keys.
Running visualvm.exe both from Explorer and from Command Prompt shows "Cannot find Java 1.8 or higher." dialog. This is expected because the VisualVM launcher searches for the JavaSoft registry keys on Windows, which is missing. JAVA_HOME is not read by the launcher.
Running visualvm.exe --jdkhome C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot shows "Cannot locate java installation in specified jdkhome: C:\Program" dialog. This is expected because there is a space in path (Program Files).
The correct way to run VisualVM on Windows using the AdoptOpenJDK11 installed with the default settings is visualvm.exe --jdkhome "C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot" (path to JDK in quotes).
I don't see any bug here, works exactly as designed and expected.
Reacted by duranlisandro, Saikoushik Gandikota, haz00, firehooper, Vitaly Belenky, Matias Fabian Lecaros Aranis, Anthony S. and Arkady Chesnokov
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit]
"CurrentVersion"="1.8"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8]
"JavaHome"="C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.242.08-hotspot"
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit]
"CurrentVersion"="1.8"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8]
"JavaHome"="C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.242.08-hotspot"
Just one more datapoint. Using Win10, installed via Scoop (MCOfficer's bucket), which basically downloads the archive and decompresses it. And having an AdoptJdk14 hotspot installed (again just put somewhere) and using --jdkhome does not work.
But editing the JDKhome config seteting in etc/visualvm.conf works.
Using --jdkhome or editing etc/visualvm.conf should have the same effect. Can you please share your command to start VisualVM using the --jdkhome switch and the working visualvm.conf file?
Thanks for the quick response! Now I cannot reproduce it :o --jdkhome works. (Reverted to original .conf file and copied the path to JDK directly into powershell console and visualVM started.)
Interestingly if I supply a wrong path I get the confirmation dialog asking me whether I'd like to try the default. (And then I get the error popup.)
Hm, looking back at the console log, it seems I mistyped jdkhome before :(
First Steps
1. Unzip the downloaded archive. The archive already contains the top-level visualvm directory.
2. Start VisualVM by invoking the binary appropriate for your OS:
visualvm\bin\visualvm.exe or visualvm/bin/visualvm
You may provide additional options to define JDK and/or VisualVM user directory:
--jdkhome "<path to JDK>" --userdir "<path to userdir>"
3. Check out the Getting Started document, it's designed to help you start using VisualVM.
And Getting Started (referred just above in its point 3) indicates:
Starting VisualVM
To start VisualVM on Windows, run the visualvm.exe program that is in the \bin folder
under the VisualVM install folder. On Unix or Linux use the visualvm shell script that is
in the /bin folder under the VisualVM install folder. You may specify the JDK which runs
VisualVM and/or user directory using command line parameters or by modifying
etc\visualvm.conf file. Example command for starting VisualVM with custom JDK and
userdir on Windows is:
visualvm.exe --jdkhome "C:\Software\Java\jdk1.6.0" --userdir "C:\Temp\visualvm_userdir"
Running visualvm.exe both from Explorer and from Command Prompt shows "Cannot find Java 1.8 or higher." dialog. This is expected because the VisualVM launcher searches for the JavaSoft registry keys on Windows, which is missing. JAVA_HOME is not read by the launcher.
works exactly as designed and expected
Could you consider changing the design? What is the rationale? Why does the launcher read JavaSoft registry and not JAVA_HOME?
Activity
jisedlac commentedon Oct 19, 2018
Thanks for the report! Please verify that using the "--jdkhome" parameter works for you - see the First Steps section at the bottom of http://visualvm.github.io/download.html.
thibaultmeyer commentedon Oct 19, 2018
Using
--jdkhomeparameter works ! VisualVM start with successthurka commentedon Oct 19, 2018
If you want to select particular JDK permanently, you can add path to JDK to
visualvm/etc/visualvm.conffile.cawoodm commentedon Jun 21, 2019
Why doesn't VisualVM just use the the
JAVA_HOMEenvironment variable to find Java?thurka commentedon Jan 31, 2020
Based on the initial report, I downloaded JDK 11 installer for Windows and JDK 8 installer for Windows from https://github.com/ojdkbuild/ojdkbuild . I installed both JDKs on WIndows 10. I downloaded VisualVM 1.4.4, unzipped it and VisualVM started just fine. There was no complain about missing Java 1.8.
Borwe commentedon Feb 22, 2020
The problem appears to have come back, I am using adoptopenjdk 11. even if I use --jdkhome, it still can't find it, even with Visual VM2 on Windows 10.
EDIT: Nevermind, solved problem, by using '/' for system paths instead of '' on Windows, then --jdkhome recognized adoptopenjdk 11, thanks.
jisedlac commentedon Feb 22, 2020
Do you mean you had to use
visualvm.exe --jdkhome C:/Path/To/<JDK_HOME>instead ofvisualvm.exe --jdkhome C:\Path\To\<JDK_HOME>on Windows? Please provide the full command to start VisualVM on your setup to make it clear for us.Borwe commentedon Feb 23, 2020
Yes that.
jisedlac commentedon Feb 24, 2020
Tested on a fresh Windows 10 installation, VisualVM 2.0 and AdoptOpenJDK 11.0.6.
Using the Windows installer, default settings, the JDK is installed to
C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot, and the Windows registry is NOT updated with the JavaSoft keys.Running
visualvm.exeboth from Explorer and from Command Prompt shows "Cannot find Java 1.8 or higher." dialog. This is expected because the VisualVM launcher searches for the JavaSoft registry keys on Windows, which is missing. JAVA_HOME is not read by the launcher.Running
visualvm.exe --jdkhome C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspotshows "Cannot locate java installation in specified jdkhome: C:\Program" dialog. This is expected because there is a space in path (Program Files).The correct way to run VisualVM on Windows using the AdoptOpenJDK11 installed with the default settings is
visualvm.exe --jdkhome "C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot"(path to JDK in quotes).I don't see any bug here, works exactly as designed and expected.
fukasawah commentedon Mar 25, 2020
fyi.
eg.)
JAVA_HOME=C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspotUse
--jdkhomeoptionIts works.
visualvm.exe --jdkhome "C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspot"visualvm.exe --jdkhome "C:/Program Files/AdoptOpenJDK/jdk-8.0.242.08-hotspot"visualvm.exe --jdkhome "C:/Program Files/AdoptOpenJDK/jdk-8.0.242.08-hotspot/"It does not work...
visualvm.exe --jdkhome "C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspot\"(...Why allow trailing slash, but disallow trailing backslash?)
Use registry
ref: https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-microsoft-windows-platforms.htm#JSJIG-GUID-47C269A3-5220-412F-9E31-4B8C37A82BFB
Borwe commentedon Mar 25, 2020
Yup, that was the problem I had.
PAStheLoD commentedon Apr 24, 2020
Hello,
Just one more datapoint. Using Win10, installed via Scoop (MCOfficer's bucket), which basically downloads the archive and decompresses it. And having an AdoptJdk14 hotspot installed (again just put somewhere) and using --jdkhome does not work.
But editing the JDKhome config seteting in etc/visualvm.conf works.
jisedlac commentedon Apr 24, 2020
Using --jdkhome or editing etc/visualvm.conf should have the same effect. Can you please share your command to start VisualVM using the --jdkhome switch and the working visualvm.conf file?
PAStheLoD commentedon Apr 24, 2020
Thanks for the quick response! Now I cannot reproduce it :o --jdkhome works. (Reverted to original .conf file and copied the path to JDK directly into powershell console and visualVM started.)
Interestingly if I supply a wrong path I get the confirmation dialog asking me whether I'd like to try the default. (And then I get the error popup.)
Hm, looking back at the console log, it seems I mistyped jdkhome before :(
Sorry for the false alarm!
manueljordan commentedon May 4, 2020
I just downloaded and unzipped the 2.0.1
visualvm_201.zip- standalone releaseWhen I execute
visualvm.exethrough either double click or through a command terminal appears:I can execute in peace the following commands and appears their respective results:
echo %JAVA_HOME%java --versionjavac --versionI am working with OpenJDK 11
Well, according with the official documentation
Download indicates:
And Getting Started (referred just above in its point 3) indicates:
Therefore:
Bug
JAVA_HOMEis ignoredSolution
Two ways
One: through the command parameter:
visualvm.exe --jdkhome "C:\yourusername\java\openjdk\jdk-11.0.7+10"From above, is mandatory use
""and not use=Therefore - for example:
visualvm.exe --jdkhome="C:\yourusername\java\openjdk\jdk-11.0.7+10"is invalid - it uses=Two: in the
etc\visualvm.conffile - almost in the bottom add:visualvm_jdkhome="C:\yourusername\java\openjdk\jdk-11.0.7+10"From above, is mandatory use
""and use=I hope it helps for all developers arriving to this thread.
4 remaining items
firehooper commentedon Apr 12, 2021
`::visualvm.bat under bin
%~d0
cd %~dp0
visualvm.exe --jdkhome "%JAVA_HOME%"
pause
`
HarishA-Lexel commentedon May 27, 2021
This solution worked greatly
artmotion commentedon Feb 1, 2022
Got the same error and just used the "--jdkhome" parameter in this way:
visualvm --jdkhome %JAVA_HOME%baseely commentedon Feb 8, 2022
You may or may not need to surround your JAVA_HOME env. variable with double quotes as:
visualvm --jdkhome "%JAVA_HOME%"This worked fine for me!lost22git commentedon Sep 12, 2022
visualvm --jdkhome $env:JAVA_HOMEin powershellmkarg commentedon Mar 20, 2023
I confirm that trailing backslash produces the problem. Can someone please fix that? Thanks! :-)
lbalazscs commentedon Apr 21, 2023
As a workaround for the trailing backslash problem, the following .bat file works for me:
OndrejSpanel commentedon Dec 5, 2023
Could you consider changing the design? What is the rationale? Why does the launcher read JavaSoft registry and not JAVA_HOME?
ipcm27 commentedon Dec 20, 2023
--jdkhome worked for me.
What I did:
2 )visualvm --jdkhome <path_to_jdk>
https://visualvm.github.io/docs/command-line-options.html
GH-112 use JAVA_HOME and JDK_HOME env. variable to find JDK
thurka commentedon May 13, 2024
Launcher was changed to also use JAVA_HOME and JDK_HOME environment variables to find JDK. This hopefuly improves the situation on Windows platform.
thurka commentedon Jul 17, 2024
Fix is part of VisualVM 2.1.9
santiagocabreraprft commentedon Dec 13, 2024
I had a problem looks like regarding my jdk
try with different jdks