• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            白云哥

            身披半件長工衣,懷揣一顆地主心

             

            使用NetBeans調(diào)試SmartFoxServer的Extension

            結(jié)束了兩個(gè)星期的用trace進(jìn)行SmartFoxserver Extension調(diào)試的痛苦歷史之后,我決定再來嘗試一下怎么在IED環(huán)境下進(jìn)行遠(yuǎn)程調(diào)試。

            上一次打算在Eclipse下進(jìn)行,不知道哪一個(gè)環(huán)節(jié)出錯(cuò),沒能成功,這次改用NetBeans吧,正好趕上NetBeans新版本發(fā)布,來試用一次。

             

            按照這里描述的方法,很快把Eclipse下創(chuàng)建的工程導(dǎo)入到了NetBeans下,不過遇到了點(diǎn)小問題,一堆的亂碼。檢查了下發(fā)現(xiàn),Eclipse下創(chuàng)建的文件編碼為ANSI,在NetBeans下不識(shí)別其中的中文注釋,把文件改成UTF-8后問題解決,可后來我再試圖在Eclipse下打開這些文件時(shí)問題又出現(xiàn)了,Eclipse只識(shí)別ANSI編碼的文件?似乎不大可能吧,不過一時(shí)也沒找到解決方法,暫時(shí)放棄,改用NetBeans吧。

             

            按照論壇上的方法做就行,不過可能因?yàn)榘姹靖碌脑颍瑢?shí)際做的時(shí)候還是有點(diǎn)差別

             

            Step 1
            Download the
            Netbeans IDE for java development. (47mb SE version should be fine!)

            這一步就是這樣了


            Step 2
            Install and open Netbeans. Create a project from existing java source pointing to where your extensions are. Should be placed in src subfolder to be nice.
            (I for sure could not make it work if the source was not in a subfolder)
            Right click on project and choose properties->libraries. Add all jar files from your smartfox installation lib dir.

            在NetBeans下導(dǎo)入原來Eclipse創(chuàng)建的文件,只需要src目錄即可

            導(dǎo)入libraries時(shí)注意,按照這里的方法,只需要導(dǎo)入3個(gè)jar文件,就是這樣

            nb5


            Step 3
            Goto Files tab. Expand nbbuild.xml. Click on -post-compile target.
            Copy and paste the following code: (Note: adjust todir to point to your smartfox program extension directory)
            <copy todir="C:\Programmer\SmartFoxServerPRO_1.6.6\Server\javaExtensions">
            <fileset dir="${build.dir}/classes/"/>
            </copy>

            我的NetBeans下沒有nbbuild.xml,倒是有一個(gè)build.xml,不過里面沒內(nèi)容 悲傷

            再看了下,原來引用的build-impl.xml,上面有個(gè)簡單的介紹,在build.xml里添加如下內(nèi)容即可:

            <target name="-post-compile">
                    <copy todir="D:\SmartFoxServer\Server\javaExtensions">
                        <fileset dir="${build.dir}/classes/"/>
                    </copy>
            </target>

            根據(jù)你的SmartFoxServer安裝目錄進(jìn)行修改即可


            Step 4
            Create a new batchfile called SmartFoxDebug?.bat
            Copy and paste the following content into it: (Again adjust to your installation directory)
            C:\Programmer\SmartFoxServerPRO_1.6.6\Server\wrapper.exe -c "C:\Programmer\SmartFoxServerPRO_1.6.6\Server\conf\wrapper.conf"

            這一步不需要,在我安裝的目錄下直接有個(gè)smarfoxService.bat批處理文件,用它就行了


            Step 5
            Add the following lines to your wrapper.conf

            Code:

            # runtimedebug
            wrapper.java.additional.3=-Xdebug
            wrapper.java.additional.4=-Xnoagent
            wrapper.java.additional.5=-Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=n

            這里的意思是要在SmartFoxServer里開戶遠(yuǎn)程調(diào)試的監(jiān)聽,在我安裝的SFS版本里原來比這多了一項(xiàng)配置,所以最終是這樣的:

            # Java Additional Parameters
            wrapper.java.additional.1=-server
            wrapper.java.additional.2=-Dfile.encoding=UTF-8
            wrapper.java.additional.3=-Djava.util.logging.config.file=logging.properties
            wrapper.java.additional.4=-Xdebug
            wrapper.java.additional.5=-Xnoagent
            wrapper.java.additional.6=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

             

            Step 6
            Choose Run->Build main project (F11) in Netbeans.
            If build is ok, click the batch file. Now select debug->attach debugger and choose port 8888. Debugger console should say "User program running".
            Now you can place breakpoints and trigger your extensions normally.

            這里就是最終我們要實(shí)現(xiàn)的效果了,掛接SmartFoxServer的遠(yuǎn)程JVM進(jìn)行調(diào)試,配置項(xiàng)在 調(diào)試(D) 下的 連接調(diào)試器(A) ,如果你跟我一樣安裝的是中文版NetBeans的話 微笑

            貼張圖,就是這樣,注意端口號,是上面配置的那個(gè),不是SFS對客戶端連接的監(jiān)聽商品號9393哦

            config

             

             

            好了,先啟動(dòng)SFS,用上面說的那個(gè)批處理文件,你會(huì)看到一行提示信息,JVM遠(yuǎn)程調(diào)試的監(jiān)聽已打開

            然后連接調(diào)試器

            在NetBeans里打個(gè)斷點(diǎn)看看,O了



            posted on 2010-07-22 08:12 白云哥 閱讀(2010) 評論(0)  編輯 收藏 引用 所屬分類: Bada

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(4)

            隨筆分類

            隨筆檔案

            相冊

            我的鏈接

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            91精品国产91久久久久久蜜臀| 伊人久久久AV老熟妇色| 久久亚洲私人国产精品| 久久久久国产精品| 久久只有这里有精品4| 久久免费高清视频| 国产精品久久久久久久人人看 | 精品久久久久久久国产潘金莲| 伊色综合久久之综合久久| 精品久久久久久国产潘金莲| 国产精品美女久久久久av爽| 久久精品国产2020| 久久久久人妻一区精品果冻| 国产成年无码久久久久毛片| 狠狠色丁香久久婷婷综合蜜芽五月 | 久久婷婷五月综合97色一本一本| 久久青青草原国产精品免费| 亚洲成色WWW久久网站| 欧美一区二区三区久久综合| 久久久噜噜噜www成人网| 久久精品午夜一区二区福利| 国产精品99久久久久久猫咪| 久久久久人妻一区精品色| 天天综合久久久网| 日本精品久久久久久久久免费| 久久久国产亚洲精品| 久久精品三级视频| 国产亚洲精久久久久久无码AV| 97久久久精品综合88久久| 欧美熟妇另类久久久久久不卡| 久久妇女高潮几次MBA| 亚洲人成电影网站久久| 午夜精品久久久久久久无码| 久久AAAA片一区二区| 国产农村妇女毛片精品久久| 国产精品99久久不卡| 久久久久久久久久免免费精品| 久久人人爽人人精品视频| 久久久久亚洲AV无码去区首| 久久夜色精品国产亚洲av| 国产精品久久久久久久久久影院 |