简体   繁体   中英

Configuring Glassfish 3.0 for profiling with NetBeans on Mac OS

This is related to a known bug in NetBeans 7. NetBeans has a wizard to configure Glassfish for profiling, but the configuration gets garbled when there's a space in the path where NetBeans is installed (which is the case in the default installation, so I have no idea how they didn't catch that one).

I'd like to figure out how to work around this. (I could rename the NetBeans app, but that would cause other problems, so let's forget that for now.) NetBeans is putting this into my domain.xml, which is plainly wrong:

<profiler enabled="true" name="NetBeansProfiler">
   <jvm-options>-agentpath:/Applications/NetBeans/NetBeans</jvm-options>
   <jvm-options>7.0.app/Contents/Resources/NetBeans/profiler/lib/deployed/jdk15/mac/libprofilerinterface.jnilib=/Applications/NetBeans/NetBeans</jvm-options>
   <jvm-options>7.0.app/Contents/Resources/NetBeans/profiler/lib,5140</jvm-options>
</profiler>

( /Applications/NetBeans/NetBeans 7.0.app is where I have NetBeans installed)

What I'd like to know is, what are the correct JVM options? That way, I could put them in the file manually.

与其重新安装netbeans,不如尝试创建一个不包含空格的符号链接,然后编辑配置文件以使用符号链接路径。

Figured it out. (Line breaks added for readability, inside <jvm-options> it's actually all one line.) Note the double quotes - these are needed if the path contains spaces.

<profiler enabled="true" name="NetBeansProfiler">
          <jvm-options>"-agentpath:/Applications/NetBeans
             /NetBeans 7.0.app/Contents/Resources/NetBeans
             /profiler/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=
             /Applications/NetBeans/NetBeans 7.0.app/Contents
             /Resources/NetBeans/profiler/lib,5140"</jvm-options>
</profiler>

The format goes like this:

-agentpath:$LIB_FILE=$LIB_DIR,$PORT

This works with Glassfish 3.0.1. There was a bug in some earlier versions where it would choke on quotes inside jvm-options , so adjust accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM