Space in Path on Windows
By Jiri Sedlacek-Oracle on Oct 04, 2006
Sometimes you may experience problems when using the Profiler installed in path which contains spaces. Whereas for using Profile Project action everything works fine, for Attach Profiler where you have to start profiled application with special "
-agentpath" argument problems may occur. For default NetBeans installation directory on Windows the argument typically looks like this:
-agentpath:"C:\\Program Files\\netbeans-5.0\\profiler1\\lib\\deployed\\jdk15\\windows\\profilerinterface.dll=\\"C:\\Program Files\\netbeans-5.0\\profiler1\\lib\\"",5140
However, some applications/servers parse this argument from command line incorrectly and pass it to the Profiler agent in bad format. Typically you will find something like "
Profiler Agent: Options: >\\C:\\Program<" in profiled application's console in that case and profiled application fails to start.
There is a simple workaround to fix this problem: 8.3 DOS path format should be used, it doesn't contain spaces in path. Then all quotes and escape backslashes need to be removed. Profiler argument in this format looks like this:
Whereas for "
C:\\Program Files" the short form should always be "
C:\\PROGRA~1", for other directories you should ask the OS for correct path. You can do it in Command Prompt (cmd.exe) using
dir /X command. In general getting 8.3 paths is not as trivial as it may seems, the best way is to call GetShortPathName function of Windows API.
And - of course - another simple workaround is to move the NetBeans directory somewhere on path without spaces.