Search code examples
javajvmvisualvmjvisualvm

Need help running visualvm on Windows when under VMWare


I am doing some Java development on Windows 7 x64 running inside VMWare Fusion 3.x (OSX). I have installed JDK6 (update 26), set JAVA_HOME to the path (no trailing slash), and restarted my command prompt.

I can successfully launch the program. During startup it runs the calibration and then fails with this error:

"Could not create directory\VMWare-host\Shared Folders\ .nbprofiler" (no space after that slash but the markup was hiding the period)

I can click to continue, but when I'm in the program I cannot do CPU or Memory profiling. I throws up a similar error box:

"Error retrieving saved calibration data for target JVM: Could not create...(same as earlier)"

Once upon a time I had this working by passing the --userdir flag and -J-Dnbprofiler.home during startup, but that trick isn't working anymore.

(The complete command was: jvisualvm --userdir c:\Users\myname -J-Dnbprofiler.home=c:\Users\myname )

How can I force jvisualvm to save its calibration data on a "real" drive instead of the vmware network drive and get this working?


Solution

  • .nbprofiler directory is derived from user.home system property. I am not sure what you did to Windows installation, but your user.home points to directory\VMWare-host\Shared Folders. So one solution is to fix the Windows installation, so that Java recognize c:\Users\myname as your user home directory. If that fails for some reason you can use nbprofiler.home property to override it, as you correctly wrote. However you should point it to the nonexistent directory, so you should start VisualVM with the following commandline:

    jvisualvm -J-Dnbprofiler.home=c:\Users\myname\nbprofiler --userdir c:\Users\myname\visualvm_userdir 
    

    One last note, even if the profiler part is not working, you should be able to use sampling in the 'Sampler' tab.