0

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?

cremes
  • 33
  • 1
  • 4

3 Answers3

3

.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.

Tomas Hurka
  • 6,723
  • 29
  • 38
  • Excellent, that worked! BTW, I didn't do anything special when installing Windows so I don't know how or why user.home is not pointing to the correct location. I **assume** it is some behind-the-scenes twiddling that VMWare is doing. – cremes Sep 10 '11 at 15:18
  • 1
    Java uses Windows registry and shell32.dll API to get the users home directory. I fact it looks for Desktop folder and uses parent directory as a home directory. Where is your "Desktop" folder? – Tomas Hurka Sep 27 '11 at 15:31
  • That would be the issue then. Java is not taking the Windows Folder Redirection feature into account. VMWare enables you to sync your important user folders through the Folder Redirection feature, which means that everything maps to the host system for these key folders. So desktop is being mapped to the above folder as a sub-folder, and it's parent is therefore wrong. Thanks Tomas, this solves another issue I was having along with a current one I am working through with a number of Java apps that are being similarly confused when Folder Redirection is enabled. – Brandon Langley Aug 24 '12 at 21:17
0

I found the following command works for me.

visualvm -J-Duser.home=%HOME%

Also, I needed to add -Duser.home=%HOME% to my app startup command.

I had defined nbprofile.home and userdir, but I was still getting an error when the Profiler was running against my app: Profiler Agent Error: Could not create directory\vmware-host\Shared Folders.nbprofiler.

I discovered that the Profiler was using user.home defined by my app rather than the one with visualvm. Both seem to be needed.

ontrack
  • 1
  • 1
0

Try disable Sharing for the VM.

It works for me with Windows 7 x86 in Fusion with Sharing disabled (and Sharing is the mechanism providing the folder you cannot write to).

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • Not feasible. The VM image has very little disk space so it needs the shared drive to get access to the code I am running, data for the program, etc. – cremes Sep 09 '11 at 16:05
  • Then I would suggest you have a look at the source code for VisualVM to find the reason it thinks that the shared drive is usable. – Thorbjørn Ravn Andersen Sep 09 '11 at 16:11