{"id":754,"date":"2013-06-21T18:55:11","date_gmt":"2013-06-21T16:55:11","guid":{"rendered":"http:\/\/www.pellissier.co.za\/hermien\/?p=754"},"modified":"2013-06-21T18:55:11","modified_gmt":"2013-06-21T16:55:11","slug":"another-source-adventure","status":"publish","type":"post","link":"https:\/\/www.pellissier.co.za\/hermien\/?p=754","title":{"rendered":"Another Source Adventure"},"content":{"rendered":"<p>In the <a href=\"http:\/\/www.pellissier.co.za\/hermien\/?p=743\">previous blog post<\/a>, some areas remained unexplored. Specifically, how to observe the values of variables with versions of the IDE that don&#8217;t include debug information. In this guest post by <em>Robert Bracko<\/em>\u00a0(robert [dot] bracko [at] vip [dot] hr), he describes his experiences with building the NetBeans IDE source code to overcome this obstacle.<\/p>\n<p><span style=\"font-family: Calibri;\"><b>Step 1: Building NB sources<\/b><br \/>\n<\/span><\/p>\n<ol>\n<li><span style=\"font-family: Calibri;\">Create local disk folder\u00a0<tt>C:\\nb6_9_1<\/tt>\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Download NB platform sources (<tt><tt>netbeans-6.9.1-201007282301-<\/tt><\/tt><wbr \/><tt>src.zip<\/tt>) and extract it into\u00a0<tt>C:\\nb6_9_1\\src<\/tt>\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Download NB binaries (<tt><tt>netbeans-6.9.1-201007282301-<\/tt><\/tt><wbr \/><tt>ml-javase.zip<\/tt>). This step is necessary for getting the appropriate Ant builder. Extract only\u00a0<tt>netbeans\\java\\ant<\/tt>\u00a0into\u00a0<tt>C:\\nb6_9_1\\ant<\/tt>. Result of that operation should be that\u00a0<tt>C:\\nb6_9_1\\ant\u00a0<\/tt>contains ant subfolders\u00a0<tt>bin<\/tt>,\u00a0<tt>etc<\/tt>,\u00a0<tt>extra<\/tt>,\u00a0<tt>lib<\/tt>&#8230;\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Create batch file (<tt>buildenv.bat<\/tt>) inside the folder\u00a0<tt>C:\\nb6_9_1<\/tt>. Put the following lines (adjust\u00a0<\/span><span style=\"font-family: Calibri;\">JAVA_HOME to match<\/span><span style=\"font-family: Calibri;\">\u00a0your Java JDK path!):<br \/>\nset JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_12<br \/>\nset ANT_HOME=C:\\nb6_9_1\\ant<br \/>\nset PATH=%JAVA_HOME%\\bin;%ANT_<wbr \/>HOME%\\bin;%PATH%<br \/>\nset ANT_OPTS=-Xmx1g<\/p>\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Open command shell and change directory to\u00a0<tt>C:\\nb6_9_1<\/tt>. Execute\u00a0<tt>buildenv.bat<\/tt>. Then change directory to NetBeans source which is to be built (<tt>C:\\nb6_9_1\\src<\/tt>). Execute ant (without any cmd-line params). Please be patient; depending on your machine power, the process can take up to hour!<br \/>\n<\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: Calibri;\">As a result of above-described procedure, new folder is created:\u00a0<tt>C:\\nb6_9_1\\src\\nbbuild<\/tt>.<\/p>\n<p>General notes<br \/>\n<\/span><\/p>\n<ul>\n<li><span style=\"font-family: Calibri;\">For some reason, path of Ant installation directory must not contain spaces!<\/span><\/li>\n<li><span style=\"font-family: Calibri;\">If building for the first time,\u00a0<span style=\"text-decoration: underline;\">disable<\/span>\u00a0Windows Firewall because for some reason it prevents Ant from downloading jars from web.<\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Possible build error &#8220;java.lang.OutOfMemoryError&#8221; can be overridden by following batch command: set ANT_OPTS=-Xmx1g<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Calibri;\">Note on building NB 6.9.1 sources:<\/p>\n<p>During build process, you will probably encounter the following error:<br \/>\nC:\\nb6_9_1\\src\\o.jruby.distro\\<wbr \/>unpatched_source\\jruby-1.5.0\\<wbr \/>build.xml:1141: Java returned: 1<\/p>\n<p>Please check\u00a0<a href=\"https:\/\/netbeans.org\/bugzilla\/show_bug.cgi?id=186736\" target=\"_blank\">https:\/\/netbeans.org\/bugzilla\/<wbr \/>show_bug.cgi?id=186736<\/a>\u00a0for a workaround.<\/p>\n<p><b>Step 2: Debugging specific NB platform and\/or NB module that was developed for that platform<\/b><\/p>\n<p>Open your development IDE (in my case, it&#8217;s NB 7.3).<br \/>\nThere are two possible ways to debug NB module that was developed for specific NB target-platform (in our case, it&#8217;s for NB 6.9.1). I prefer the first one (<tt>\"Adding target platform through NetBeans Platform Manager\"<\/tt>) because it&#8217;s not necessary to install NBM inside target-IDE.<br \/>\n<\/span><\/p>\n<ol>\n<li><span style=\"font-family: Calibri;\"><b>Adding target platform through NetBeans Platform Manager<\/b>\n<p><\/span><\/p>\n<ol>\n<li><span style=\"font-family: Calibri;\">Choose from main menu Tools &gt; NetBeans Platforms. Press button &#8220;Add Platform&#8230;&#8221;. Choose the folder\u00a0<tt><tt>C:\\nb6_9_1\\src\\nbbuild\\<\/tt><\/tt><wbr \/><tt>netbeans<\/tt>. Let NB decide on the name of platform (&#8220;nb691&#8221;).\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Choose tab &#8220;Sources&#8221; and add the following folder:\u00a0<tt>C:\\nb6_9_1\\src<\/tt>\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Choose tab &#8220;Harness&#8221; and check whether radio-button &#8220;Harness supplied with Platform&#8221; is selected\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Open your NBM project.<br \/>\nThe following is important! Open Project Properties &gt; Libraries and adjust the field &#8220;NetBeans Platform&#8221; to hold the value nb691!<\/p>\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Set the breakpoint inside your NBM code.\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Optionally, you can set the breakpoint inside NB platform source code. For instance, let&#8217;s imagine that your NBM uses functionality of NB class AbsoluteLayoutSupport and you want to check the interaction. Make a Windows file-search inside the folder\u00a0<tt>C:\\nb6_9_1\\src<\/tt>. That results in containing folder\u00a0<tt><tt>C:\\nb6_9_1\\src\\form\\src\\org\\<\/tt><\/tt><wbr \/><tt><tt>netbeans\\modules\\form\\<\/tt><\/tt><wbr \/><tt>layoutsupport\\delegates<\/tt>. So open the folder\u00a0<tt>C:\\nb6_9_1\\src\\form<\/tt>\u00a0as another project\u00a0<b>in your development-IDE<\/b>(uncheck the checkbox &#8220;Open Required Projects:&#8221;). Expand Projects window node Form Editor &gt; Source Packages &gt; org.netbeans.modules.form.<wbr \/>layoutsupport.delegates. Double click on AbsoluteLayoutSupport.java and set the breakpoint.\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Inside Projects window, right click on your NBM and choose Debug from the context menu<\/span><span style=\"font-family: Calibri;\">. That makes target-IDE (6.9.1) to launch. Choose Tools &gt; Plugins\u00a0<b>from target-IDE main menu<\/b>, then choose tab &#8220;Installed&#8221;. You should see your NBM inside the list of installed plugins. Nice, isn&#8217;t it?\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Make some action that affects your NBM and enjoy debugging \ud83d\ude42\n<p><\/span><\/li>\n<\/ol>\n<\/li>\n<li><span style=\"font-family: Calibri;\"><b>Opening src\\nbbuild as a project<\/b>\n<p><\/span><\/p>\n<ol>\n<li><span style=\"font-family: Calibri;\">Open your NBM project and set the breakpoint anywhere inside the code.\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Open the following folder as a project:\u00a0<tt>C:\\nb6_9_1\\src\\nbbuild<\/tt>. The node &#8220;NetBeans Build System&#8221; appears inside Projects window.\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Right-click the subnode build.xml and choose the following from context menu:\u00a0<\/span><span style=\"font-family: Calibri;\">Run Target &gt; tryme-debug. That makes\u00a0<\/span><span style=\"font-family: Calibri;\">target-IDE (6.9.1) to launch. Choose Tools &gt; Plugins\u00a0<b>from target-IDE main menu<\/b>, then choose tab Downloaded. Press button &#8220;Add Plugins&#8230;&#8221;, find NBM on disk and then press button &#8220;Install&#8221;. Finish the installation process, then close Plugins window.\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Make some action that affects your NBM and enjoy debugging \ud83d\ude42\n<p><\/span><\/li>\n<li><span style=\"font-family: Calibri;\">Optionally, you can set the breakpoint inside NB platform source code. Follow the same approach as given in\u00a0<b>&#8220;Adding target platform through NetBeans Platform Manager&#8221;<\/b>\u00a0step 6.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In the previous blog post, some areas remained unexplored. Specifically, how to observe the values of variables with versions of the IDE that don&#8217;t include debug information. In this guest post by Robert Bracko\u00a0(robert [dot] bracko [at] vip [dot] hr), he describes his experiences with building the NetBeans IDE source code to overcome this obstacle. &#8230; <a title=\"Another Source Adventure\" class=\"read-more\" href=\"https:\/\/www.pellissier.co.za\/hermien\/?p=754\" aria-label=\"More on Another Source Adventure\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[3,5],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1v8WL-ca","_links":{"self":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/754"}],"collection":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=754"}],"version-history":[{"count":7,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/754\/revisions"}],"predecessor-version":[{"id":761,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/754\/revisions\/761"}],"wp:attachment":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}