I'm having trouble using standard input inside JDB

Hello Java(R) community
The problem is:
I cannot read a stream of characters from the keyboard inside JDB. Just to set context I'm using:
jdk 1.3.1_01 with jdb version 99/06/11 under RedHat(R) Linux(R) 7.1
I've written the following code:
1:import java.io.*;
2:
3:public class Test {
4:
5: Reader reader = new InputStreamReader(System.in);
6: char[] buffer = new char[256];
7:
8: public void myRead() {
9:
10: System.out.print("Insert some text: ");
11: try {
12: reader.read(buffer);
13: }
14: catch (IOException e) {
15: System.out.println(e.getMessage());
16: }
17: System.out.println("You've inserted the following text: " + new String(buffer));
18: }
19:
20: public static void main(String[] args) {
21:
22: Test ref = new Test();
23: ref.myRead();
24: }
25:}
The above is compiled with javac -g Test.java
At the shell you run ' java Test ' and it just echoes the input you give to it
Inside jdb you set a breakpoint with ' stop in Test.myRead()'. When there, it stops at line 10; you invoke the 'next' command and it just don't print the message (just becuse it's not a println it just don't flush I suppose); after that the next line to execute is 12; so you invoke 'next' again and the real problem happens! Nothing can be read from the standard input. If you try to run the 'list' command jdb says "Current thread isn't suspended".
Does anyone knows what's going on?
Thanks in advance for a reply.

If you use the launching connector to start the debugee,
(this is the default used when you start jdb)
then jdb cannot tell the difference between jdb commands
that you are typing, and other text you want sent to the
debugee program. You will have the same problem with
output going the other way. The debugee program output
will be mixed in with any jdb output that comes along.
This is because the controlling window has only one stdin,
stdout, stderr that both processes (as well as anything else
you are running in that window) are forced to share.
You need to separate the debugger and debugee, as follows:
1) Start the debugee program (HelloWorld in this example)
in one command window:
% java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4571 HelloWorld
2) In another window, attach your debugger (jdb in this example)
to the debugee via a socket:
% jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=4571
You may also use the shared memory transport if you are
on a win32 platform, as follows:
1) In one command window:
% java -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,address=mine HelloWorld
2) In a second command window (again using jdb as an example):
% jdb -connect com.sun.jdi.SharedMemoryAttach:name=mine
For more information, refer to "Connection and Invocation Details"
at this URL:
http://java.sun.com/j2se/1.4/docs/guide/jpda/conninv.html

Similar Messages

  • I'm having trouble using Adobe Reader

    I'm having trouble using or uninstalling Adobe Reader, i get a message when the programme has been anitiated which says Adobe Reader has encountered a problem and needs to close, i went on to Adobe's website and it said try uninstalling Adobe Reader and then re-install it as this sometimes works, i tried un-installing it from the Add or Remove programme but that didn't work either as i got another message telling me that the patch package could not be verified and to make sure i have permission.

    Dear Mylenium.
    Sorry i don't quite understand your reply, What do you need to know?

  • Im having trouble using Emoji on some apps since i downloaded ios5... Anyone else experiencing this?

    Im having trouble using Emoji on some apps since i downloaded ios5... Anyone else experiencing this? Ive tried every thing deleting emoji and apps and re-instaling to no sucsess?? Any help would be great thanks!

    YES! I am having a lot of AppStore problems since iOS 6. My 2 main issues are:
    1. AppStore crashes constantly or will just sit & spin then does nothing at all.
    2. If I search for a specific App, making sure my spelling is correct, AppStore will NOT bring the app up. Instead, it will bring up unrelated apps.
    Podcasts app does the same thing, as well as jumbling up dates. Very impossible to find the correct episode.
    APPLE, please tell me you are reading this and that a fix is quickly under way!!

  • Im having trouble using bbciplayer on my ipad it says i need to switch to wifi but im already connected can any one help?

    im having trouble using bbciplayer on my ipad it says i need to switch to wifi but im already connected can any one help? I ve uninstalled/ reinstalled  switched it on and off what next?

    Did you try downloading the movie from iTunes on your iPad?  I know it takes longer but I'd try that. 
    Also try to reset all settings. 
    Settings > General > Reset. Reset all settings. 

  • I just downloaded Mainstage, I'm having trouble using it, because it won't open, can someone help me out?

    I have the latest Mac Os update ... I downloaded Mainstage, it won't open... Why is that???  I've deleted it, reinstalled it, but I keep having trouble using it...

    Yu have to run the library upgrader - it is in your applications folder in the utilities folder - double click on it to exceute it - then launch iPhoto after running the library upgrader
    LN

  • I'm having trouble using my redemption code to access Lightroom?

    Can any one help I am having trouble using my redemption code to access the download of lightroom

    i am having the saame trouble with my audio book.  I can get music but no longer my book. and it makes me mad. help me too.

  • I'm having trouble using my track pad. The arrow moves but I can't click on anything.

    I'm having trouble using my track pad. The arrow moves but I can't click on anything.

    Oh thank you for posting on how to enter safe browsing! I had tried to disable add-ons, but couldn't make anything click to do so. So frustrating!
    Anyway, after putting on the safe browsing, it worked *immediately*, so clearly the add-ons were the issue! I deleted a bunch I don't use anyway, and it's been working fine for hours.
    Thank you!!

  • I'm having trouble using the iTunes and Apps store because i can't register my Nigerian mastercard. What should i do. i'm trying to register it in the Nigerian iTunes store.

    I'm having trouble using the iTunes and Apps store because i can't register my Nigerian mastercard. What should i do. i'm trying to register it in the Nigerian iTunes store.

    Is this a new Apple iD? If it is, and you have already set it up, then you have two options:
    1.     Temporarily put a Credit Card or Gift Card on the account to download the free app. If you put a credit card, then once you have downloaded the app, you should be able to go into your Account preferences and change the payment option to = None.
    2.     You can download the fee App, and then set up a new Apple ID.
    Cheers,
    GB

  • I'm having trouble using my iTunes to buy things in games is ther something I should it keep telling me to contact support

    I'm having trouble using my iTunes card to purchase things in games keeps telling me to contact support. I can buy song so it is activated can anyone help??

    i am having the saame trouble with my audio book.  I can get music but no longer my book. and it makes me mad. help me too.

  • I am having trouble using home sharing.

    I am having trouble using home sharing. My brother is able to access my libary but I can't access his. Even though we put in his ID for me to access, it just loads and gives up. Can anyone help me out? My OS is windows vista and my brother's is windows 7.

    Welcome to the Apple Community.
    The following article(s) may help you.
    Troubleshooting Wi-Fi networks and connections
    Recommended Wi-Fi settings
    Troubleshooting Security Software

  • Having trouble using adobe

    HAVING TROUBLE USING ADOBE AFTER ITS INSTALLED... YOUTUBE, FACEBOOK GAMES.... SAYS OOPS TRY AGAIN

    You're in the Reader forum. You want http://forums.adobe.com/community/flashplayer

  • I having trouble using time machine

    I having trouble using time machine on my mac. When I click it, it wants me to set it up. When I click on that it says  to select backup disk but there is nothing on the page, it's blank.  What do I do next?

    Have you connected the Hard Drive you want to storage your backup? If the answer of this question is yes, you need to format it in "Mac OS Extended (Journaled)" It can be a NTFS drive and you are probably using macfuse to have permission to read and write it time machine can't write on NTFS (As far as I know) Hope it helped

  • Having trouble using escape sequences

    I'm trying to display a Christmas tree, but I'm having trouble using \ before the symbols. It won't compile.
        result.append("      \/\\ " + NEW_LINE);
        result.append("     \/  \\ " + NEW_LINE);
        result.append("    \/    \\ " + NEW_LINE );
        result.append("   \/      \\ " + NEW_LINE);
        result.append("   \-------- " + NEW_LINE);What could be the problem?

    Following your advice, it still won't compile. Sorry, my knowledge of Java is limited at this moment.
        result.append("      / /\ " + NEW_LINE);
        result.append("     /  /\ " + NEW_LINE);
        result.append("    /    /\ " + NEW_LINE );
        result.append("   /      /\ " + NEW_LINE);
        result.append("   -------- " + NEW_LINE);Error message:
    C:\Users\John\Desktop\ChristmasTree.java:18: illegal escape character
    result.append(" / /\ " + NEW_LINE);
    ^
    C:\Users\John\Desktop\ChristmasTree.java:19: illegal escape character
    result.append(" / /\ " + NEW_LINE);
    ^
    C:\Users\John\Desktop\ChristmasTree.java:20: illegal escape character
    result.append(" / /\ " + NEW_LINE );
    ^
    C:\Users\Johnny\Desktop\ChristmasTree.java:21: illegal escape character
    result.append(" / /\ " + NEW_LINE);
    ^
    4 errors
    Tool completed with exit code 1
    Edited by: jvu on Sep 18, 2008 6:25 PM

  • Hello. I am having trouble using Mobileme with microsoft oulook 2010. .The error Mobileme has stopped working . Can anybody help. ??Thanks

    Hello
    I am having trouble using Microsoft Outlook 2010. When starting Microsoft Outlook displays the error message Mobileme has stopped working. Can anybody help.
    Thanks

    Well yes, of course you are having trouble using MobileMe because MobileMe no longer exists and has not existed for the last 2 years at least.
    MobileMe has been replaced by iCloud, so you will never be able to use MobileMe because it does not exist.
    Also, I would suggest that you look more closely before you post, because you have posted this in an iPhone forum and this question has nothing to do with iPhones.  You would get more help if you posted in the correct forum.

  • I am having trouble using my I phone with Icloud. I tried diabling it & all my contacts have been cancelled.

    I am having trouble using my I phone with Icloud. I tried diabling it & all my contacts have been cancelled.

    OK, I called Plantronics and it was an easy fix.  You need to hold down the volume up button and the power button on (on the headset) at the same time until the lights on the headset start flashing red and blue.  Then turn on the phone Bluetooth and it pairs up just fine.
    Thanks fo rthe help!!

Maybe you are looking for

  • IPod Touch 3G Stuck in restore mode

    Now, wait until you here this one. I turn on my iPod, and out of nowhere, I have a 21 million minute lock. SO, I figure I'll just restart it. I put my ipod into recovery mode, and no dice on my main computer which is on Win 7 using 64-bit iTunes. I g

  • No disk, need to reinstall. help?

    I hope this is in the right place. I recently lost the audio capability on my laptop and according to the company must do a full system recovery to have my audio work again but doing this will cause me to permanently lose all my files, settings and p

  • Ques-5

    HI, Give me the solution for What is the cash application process in SAP? please solve this issue. Thanks, Rashmi

  • Can't hear the words

    I just got my nano, subscribed to itunes, and I connected the two and the songs were uploaded to my nano, I can hear the music but not the words, what am I doing wrong?

  • SL Firewall setting & Intego (Netbarrier) Firewalls

    Kind of a silly question: Should my Apple firewall be ON or OFF if I use Netbarrier? Having just upgraded to SnowLeopard I went to see what mine was set at, after reading an unrelated thread. It was OFF. (But I am running Netbarrier over the top). I