Java 开发中的远程调试
进行远程调试简单来说:只需要在java 命令后面添加上如下的参数:
-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y
例如:原先是这样启动程序的
java -cp . HelloWorld,
现在就改成这样了
java -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y -cp . HelloWorld
然后一运行就会出现如下的文字:
Listening for transport dt_socket at address: 8000
这就OK了。打开 Eclipse, 在调试里面新增一个 Remote Java Application,Host 填写上启动 Java 程序的那台服务器的地址,Port填写 8000,也就是参数中 address 后面指定的数字。剩下就跟平常一样了,断点该设就设,程序动态运行时也可以修改,不用重新拷贝,立刻生效,跟本地运行一样。当然了并不是所有的修改都可以立即生效的,有时还是需要我们把程序重新拷贝一下。
上面各个参数的含义分别是:transport=dt_socket指明了使用网络来传输,所有的平台都支持,server=y指明了启动VM的以调试服务器来执行,address=8000就是端口了,也能指定服务器IP,suspend=y则指定了VM开始的时候暂停,等待与客户端连接,连接上以后才继续执行。
更详细的内容看BEA上的《充分利用 J2EE 调试工具》一文
Comments
Wir unterhielten uns. Dabei erfuhr ich, dass er verheiratet ist, Vater einer wunderschönen zweijährigen Tochter sei. Er erzählte mir, dass er es spare nicht vorher gesagt hätte. Ich erzählte ihm ein wenig von mir, dann musste ich mich wieder anziehen, denn es würde bald hell werden. Wir küssten uns noch einmal zum Abschied.
Posted by: rastplatz | October 13, 2011 7:30 PM
You know that children are growing up when they start asking questions that have answers.
Posted by: tandartstarieven 2012 | December 9, 2011 5:20 AM
Hi there, I found your blog by means of Google whilst looking for a related subject, your web site came up, it appears great. I have bookmarked it in my google bookmarks.
Posted by: Assecco Resovia | May 23, 2012 5:17 PM
You are my intake, I have few blogs and sometimes run out from manufacturer. Truth springs from discussion amongst close friends. by Donald Hume.
Posted by: forex 4 you malaysia | June 28, 2012 1:06 AM
hey generally there i stumbled upon your site searching round the web. I planned to say I enjoy the seem of reasons for having here. Maintain that up will save for particular.
Posted by: forex factory | June 28, 2012 7:30 PM
Thanks for this post, I am a big fan of this site would like to keep updated.
Posted by: Estrella Hafter | July 24, 2012 5:36 AM
I would not waste my time with Squidoo. I wrote a article just recently here (the submit before this an individual) about the nightmare I had with them. If you build something up with Squidoo, be prepared to lose it suddenly for no reason. I cannot say anything about Hubpages as I only have got a few and those I have pretty much deserted.
Posted by: Mckinley Sorel | August 11, 2012 2:40 AM
Wow good resources! I'm looking for the great open source app for my portfolio slideshow. My old web-site had a light box feature, but I'm looking for something fresh and new. I'm am fluent with HTML and CSS, but not with scripting languages, so I'm looking for something fairly an easy task to plug in. Any recommendations? Thank you!
Posted by: TFN Melbourne | August 20, 2012 9:44 PM
Hola! I've been following your weblog for a long time now and finally got the courage to go ahead and give you a shout out from Atascocita Texas! Just wanted to say keep up the excellent work!
Posted by: fast cash payday loan | August 31, 2012 9:19 PM
hmm that is certainly definitely interesting. I wonder why it's that much. Maybe they know something we you should not about the upcoming of IDNs' ???
Posted by: Celia Vannorden | September 4, 2012 4:16 AM
Hey, cool designs.
Can we use them for our commercial use?
Posted by: Clinton Nuce | September 9, 2012 11:41 AM
It doesn't matter if Facebook(aka Borebook) shuts down!! They tell you what to do,not what you want to do. Good RIDDANCE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by: Curtis Fingar | September 10, 2012 1:10 AM
Hey there Gorgeous Resourceful neighbor!!br /I sat below examining about Elmo...and the comments that T had to say...sounded EXACTLY like him!!br /Then, as I study on, all I could do was laugh...you are very imiginative Julie!!! I really like seeing your creations and then examining about "the serious lifetime of Bella, Julie and T!"br /Yes, motherhood indeed puts us within an overall distinctive state of intellect!!
Posted by: Jake Difabio | November 19, 2012 2:17 PM
Really impressed with the website, sincerely, Dr. Jones,
Posted by: Dahlia | November 26, 2012 8:51 AM