浏览 2238 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-02-19
最后修改:2009-02-19
原文:http://jim19770812.blogspot.com/2009/02/ubuntueclipsephoneme-advancej2me4.html 先前介绍了如何编译一个具有调试功能的phoneme advance,并且介绍了如何是使用jdb基于命令行的调试调试,下面介绍一下如何使用eclipse来进行本地调试和远程调试 其实使用eclipse调试java me程序非常简单。 环境 os:ubuntu 8.10 jvm:1.6.0_10-b33 javame :phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006(personal profile) mTookKit:mtoolkit_basic_edition_2.2.0 eclipse:3.4.1 1.配置环境 1.1.复制缺少的jar包 编译之后的phoneme advance(personal profile)缺少几个包,这些包在phoneme_advanced-mr1-pp-rel-bin中可以找到,官网上下载phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006.zip,里面的phoneme_advanced-mr1-pp-rel-bin-b06-linux-10_nov_2006.zip就是我们需要的,这是不具备调试功能的phoneme advance mr1 personal profile。 解压后,在里面找到下面几个包 jim@jim-laptop:~/phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006/phoneme_advanced-mr1-pp/lib$ ls *.jar -l -rw-r--r-- 1 jim jim 5561 2006-11-10 09:53 appmanager-client.jar -rw-r--r-- 1 jim jim 72801 2006-11-10 09:53 appmanager.jar -rw-r--r-- 1 jim jim 684897 2006-11-10 09:53 AwtPDA_PresentationMode.jar -rw-r--r-- 1 jim jim 20042 2006-11-10 09:53 j2me_xml_cdc.jar -rw-r--r-- 1 jim jim 973075 2006-11-10 09:50 personal.jar 把这几个包复制到我们自己编译的phoneme advance mr1 personal profile里去 jim@jim-laptop:~/phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006/phoneme_advanced-mr1-pp/lib$ cp *.jar ~/phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006/phoneme-advanced-mr1-src/build/linux-x86-generic/lib jim@jim-laptop:~/phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006/phoneme_advanced-mr1-pp/lib$ 1.2.配置Eclipse 将~/phoneme_advanced-mr1-rel-bin-b06-linux-10_nov_2006/phoneme-advanced-mr1-src/build/linux-x86-generic 添加到Installed JREs列表里,添加方法请参考我的另外一篇文章《在ubuntu下用Eclipse开发基于PhoneMe Advance的J2me程序(1)-基本配置》,配置好之后的之后如下图所示: 配置好的Installed JREs如下图所示 2.调试 2.1.本地化调试 在程序中设置一个断点,然后执行调试,phoneme advance 会出现一个提示框 Timeout while waiting for VM to connect. Retry? 不用管它,点yes关掉它,程序自动停在了断点处,如下图所示 ok,本地化调试没问题了。 2.2.远程调试 远程调试也很简单,只是我这里只有一台开发用电脑,所以远程调试就在本机运行了。 2.2.1.启动调试服务 执行如下命令 jim@jim-laptop:~/source/j2me/java-ides/eclipse/workspaces/projects/demo1/bin$ cvm -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=7801 com.demo.Main CVM Configuration: Java stack chunk size (stackChunkSize): 1024 Java stack minimum size (stackMinSize): 1024 Java stack maximum size (stackMaxSize): 131072 GC[SS]: Initialized semi-space gen for generational GC Size of *each* semispace in bytes=1048576 Limits of generation = [0xb6c2a200,0xb6e2a200) First semispace = [0xb6c2a200,0xb6d2a200) Second semispace = [0xb6d2a200,0xb6e2a200) GC[MC]: Initialized mark-compact gen for generational GC Size of the space in bytes=4194304 Limits of generation = [0xb6e2a200,0xb722a200) GC[generational]: Auxiliary data structures heapBaseMemoryArea=[0xb6c2a008,0xb722a208) cardTable=[0x9d16788,0x9d19788) objectHeaderTable=[0x9d19790,0x9d1c790) summaryTable=[0x9d1c798,0x9d28798) 调试服务已经启动了,开启端口7801。 2.2.2.配置eclipse 打开Debug Configurations对话框,在Remote Java Application中添加一项 配置如下 Host:localhost Port:7801 选中 Allow termination of remote VM 配置如下图所示 点击Debug按钮就可以调试了,程序会自动停留在断点处,如下图所示 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |