jdb run time input needed

Reply

Join Date: Jun 2007
Posts: 25
Reputation: youngstorm is an unknown quantity at this point 
Solved Threads: 1
youngstorm youngstorm is offline Offline
Light Poster

jdb run time input needed

 
0
  #1
Feb 26th, 2009
Hello all,
I have a program running with this command 'jdb prog'. It was compiled with 'javac -g prog.java'. The program when running normally asks for input, 1st it asks for a number then it asks for a second number. When running in jdb it still asks for input so I type '5', for exmple, and jdb says "Unrecognized command: '5'. Try help...."
How do I tell jdb to send a number or string for that matter to the running program?

thank you,
Mike
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 686
Reputation: sillyboy is on a distinguished road 
Solved Threads: 61
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Practically a Master Poster

Re: jdb run time input needed

 
0
  #2
Feb 26th, 2009
jdb says? or prog says? does prog accept arguments when called or when during execution?

do you actually call run to start prog execution?
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 25
Reputation: youngstorm is an unknown quantity at this point 
Solved Threads: 1
youngstorm youngstorm is offline Offline
Light Poster

Re: jdb run time input needed

 
0
  #3
Feb 26th, 2009
I run the program like this 'java prog'. When I run do, 'prog' asks for 2 numbers, 1 after the other. Then it does a computation on them.

I am trying to debug my program. I use jdb. I start it with 'jdb prog'. While in jdb, I tell it to start executing prog by typing 'run'. jdb runs prog and prog asks for a number. It will wait on that number. I type a number but jdb thinks it is a command. and replies "Unrecognized command: '5'. Try help....". I need to tell jdb to pass the number I typr to prog so it will continue execution.

I hope this clears things up and has not made you more confused.

Mike
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 686
Reputation: sillyboy is on a distinguished road 
Solved Threads: 61
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Practically a Master Poster

Re: jdb run time input needed

 
0
  #4
Feb 26th, 2009
if you are debugging your app, i assume you have some breakpoints defined. are you hitting one of these breakpoints and not knowing it? make sure you step past any breakpoints you may have. if you are querying for user inputs, it would be logical to have prompts so the user knows when to input values too.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 25
Reputation: youngstorm is an unknown quantity at this point 
Solved Threads: 1
youngstorm youngstorm is offline Offline
Light Poster

Re: jdb run time input needed

 
0
  #5
Feb 26th, 2009
I ran it without breakpoints, just get a sense of what it is doing. I'm playing with breakpoints now. It does use prompts. When jdb runs prog, it displays the prompt to enter a number. So, I type in a number and jdb complains. It thinks the number I type is a jdb command.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,439
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 510
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: jdb run time input needed

 
0
  #6
Feb 27th, 2009
You'll probably have to attach the debugger from a separate command window.
From the Sun doc on jdb:
For example, the following command will run the MyClass application, and allow jdb to connect to it at a later time.

% java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n MyClass

You can then attach jdb to the VM with the following commmand:

% jdb -attach 8000
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 25
Reputation: youngstorm is an unknown quantity at this point 
Solved Threads: 1
youngstorm youngstorm is offline Offline
Light Poster

Re: jdb run time input needed

 
0
  #7
Mar 5th, 2009
thank you, your command worked.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC