System.out will not flush before input

Hello everyone,
I am using Netbeans 5.5, JDK6, and J2EE. I am new to the environment so I wrote a test application that would prompt a user to enter a string and then echo it. I have:
String str = "";
BufferedReader br = new BufferedReader(new nputStreamReader(System.in));
System.out.print("Enter a string: ");
System.out.flush();
try
str = br.readLine();
catch(IOException ex)
System.out.print(ex.toString());
System.out.print(str);
What is really bizarre is that System.out will NOT flush no matter what. My application will always ask for input before it even prompts the user for the string. This is what the output looks like when running:
init:
deps-jar:
compile:
run:
hello
Enter an string: hello
BUILD SUCCESSFUL (total time: 5 seconds)
Notice how I had to enter the string first? The only way that I have seen that it flushes is if I used println() instead of print. But what if I don't want the prompt to have an end line in it. This just seems like weird behavior. Also, I have tried using a Scanner for input and the results are the same. Not really sure what to do. Any help would be most appreciated. Thanks.

are you running this inside netbeans as well? the "console" view in netbeans (and eclipse, and probably other IDEs) is not a real console, it's a GUI component that the IDE writes to. it's behaviour isn't guaranteed to act like a real console. I've seen this sort of thing on eclipse before, but never used netbeans. but it still stands that an IDE's console view isn't an actual console/terminal window. that may well be the root of the problem

Similar Messages

  • Final cut 10.1 will not output or input thru Blackmagic intensity shuttle thunderbolt on 2013 Retina MBP while Premere Cs6 does

    Final Cut 10.1 will not output or input thru Blackmagic intensity shuttle thunderbolt on 2013 Retina MBP while Premere Cs6 does

    As I mentioned, Premere Cs6 has no issues with the BM Intensity Shuttle Thunderbolt. This proves that the Mac sees the shuttle. iMovie, like FCPX 10.1 does not see it. Not sure if this is an Apple issue or a BlackMagic issue. I plan to contact BlackMagic on Monday out of curiosity. This issue is more of a surprise than a dead end. Happily there are easy workarounds for capture. I use the BlackMagic software to capture. My main issue seems to be that I am unable to use FCPX to output through the Shuttle. Fortunately I have a Mac Pro and an older BlackMagic card which has worked. It is so very nice to skim video on an SSD.  No lag and no wear and tear on a mechanical hard drive. The 1Tb Apple SSD is shockingly fast. It is a new world.

  • System preferences will not open after upgrade

    upgraded software today and now system preferences will not open. when i click on it a message says "you cannot open the application 'system preferences' because it is not supported on this architecture". system preferences icon has a circle and slash symbol on top of it. my imac is about 6 months old and have not had a problem with it. all other apps work. please help.
    lennyg2
    iMac dual core   Mac OS X (10.4.7)  
    iMac dual core   Mac OS X (10.4.7)  

    Tried that, did 'repair disk permissions and it said all was ok. But when I pressed the 'Verify permissions' button it came out with an error message. Said that there was an error upon exiting, said the hard drive was damaged. Do you think that is connected to 'system preferences' not opening. As I said the 'system now has a 'circle with a slash' symbolon top of it.

  • Why System.out.println not PrintStream.println ?

    Hi, just a beginner question
    I just wonder why should we use System.out.println, not PrintStream.println ?
    the field out in the System class is the instance of PrintStream class, isn't it?
    So why don't we just use the PrintStream class directly?
    Thanks..
    Edited by: riff_almighty on Oct 27, 2007 3:27 AM

    According to the api:
    A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method. Optionally, a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.
    So there is nowhere mentioned about the PrintStream associated with the user console. System.out is the one instance of PrintStream which is associated with the console...
    Also println() is not a static method and cant be called upon the class...
    Edited by: VijayBabu on Oct 27, 2007 12:51 AM

  • HT1557 I have lion installed on my mac.  My desktop and screensaver, in system preferences, will not load.  Everything else, seems to be okay.  Any suggestions?

    I have Lion installed on my mac.  My desktop and screensaver, in system preferences will not load.  I have to Force close it, after it's been open.  I know that I
    can change my desktop pic, by clicking "change my desktop, but I would like to understand what made it freeze up like that.  All I get is that thing that looks like a piece of candy.  From there, it does nothing.  The rest of the system preferences work fine.  It's like its caught in a loop of some kind.  I would appreciate any help that I can get.  Thanks.

    Since you are still under the Apple warranty, please give Apple tech support a call (before your 90 day phone support expires, if you did not buy the APP yet...) If the problem is more than just a simple software glitch, they will be able to fix it right away for you...
    The tech support hotline is open 24x7:
    USA: 1-800-APL-CARE (1-800-275-2273)
    Canada: 1-800-263-3394
    World: http://www.apple.com/support/contact/phone_contacts.html

  • My system preferences will not load

    hi please help my system preferences will not load when i use my account how ever when i load my partners account it works fine i have updated the software and still nothing the imac is brand new and i have loaded all of my old files on it and now after all the hours i have spent getting to this stage the last thing i want to do is have to take it back to apple and reset it please help?????

    Quite alright.  Once you sort out this issue, see these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac 101: Mac Essentials,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual,
    Snow Leopard Edition.&
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • In iCal - I keep getting the error message " This calendar was created by Mail" and it will not accept any input; why..??

    In iCal - I keep getting the error message “ This calendar was created by Mail” and it will not accept any input; why..??

    use Disk Utility and Verify Permisions then fix and Verify Disk and fix, this should fix it.

  • Safari: Will NOT Open and Menu Bar will NOT Respond to input

    Safari: When opening Safari it sticks on Top Sites, Menu Bar will NOT respond to inputs and wheel spins indefiantly.  Can someone assist? (I am using OS X Lion 10.7.5 on Macbook Pro)

    If you updated to 6.1 & the problems began then - you might have Glims installed...
    How do I uninstall Glims? | www.MacHangout.com
    If not, test briefly in a new or Guest user account on your computer.

  • System Profiler will not recognize installed hard drive if drive is in use by VMWare

    System Information will not recognize installed Hard Drive (Boot Camp) when in use by VMWare.
    I work in IT for a School District and I am creating a Script that system information about the computer. I am testing this on a Mac Pro with two internal hard drives. One drive is Mac OS 10.8 and the other drive is a Boot Camp Drive that is used by VMWare Fusion.
    When I run System Information via the GUI or system_profiler via Terminal, both drives show up just fine. However, if I launch VMWare Fusion and run Windows from my Boot Camp drive, then run System Information via the GUI or system_profiler via Terminal, the Boot Camp Drive is no longer listed as an installed drive.
    Example:
    In the Terminal, I enter the following command.
    system_profiler SPStorageDataType
    Then it returns this information.
    Storage:
        Lion Client:
          Available: 217.84 GB (217,836,306,432 bytes)
          Capacity: 639.28 GB (639,275,270,144 bytes)
          Mount Point: /
          File System: Journaled HFS+
          Writable: Yes
          Ignore Ownership: No
          BSD Name: disk0s2
          Volume UUID: CCB501BF-AF24-30E7-A938-5A4E52DF14D7
          Physical Drive:
              Media Name: WDC WD6400AAKS-41H2B0 Media
              Medium Type: Rotational
              Protocol: SATA
              Internal: Yes
              Partition Map Type: GPT (GUID Partition Table)
              S.M.A.R.T. Status: Verified
        BOOTCAMP:
          Available: 255.58 GB (255,575,560,192 bytes)
          Capacity: 319.79 GB (319,790,510,080 bytes)
          Mount Point: /Volumes/BOOTCAMP
          File System: NTFS
          Writable: No
          Ignore Ownership: Yes
          BSD Name: disk1s2
          Volume UUID: D4B39D4E-E244-403C-AE4D-4D58397130DE
          Physical Drive:
              Media Name: WDC WD6400AAKS-41H2B0 Media
              Medium Type: Rotational
              Protocol: SATA
              Internal: Yes
              Partition Map Type: GPT (GUID Partition Table)
              S.M.A.R.T. Status: Verified
    Then I launch VMWare, which uses the Boot Camp drive. The once again run the same command from the Terminal Command and I get this.
    Storage:
        Lion Client:
          Available: 213.39 GB (213,392,244,736 bytes)
          Capacity: 639.28 GB (639,275,270,144 bytes)
          Mount Point: /
          File System: Journaled HFS+
          Writable: Yes
          Ignore Ownership: No
          BSD Name: disk0s2
          Volume UUID: CCB501BF-AF24-30E7-A938-5A4E52DF14D7
          Physical Drive:
              Media Name: WDC WD6400AAKS-41H2B0 Media
              Medium Type: Rotational
              Protocol: SATA
              Internal: Yes
              Partition Map Type: GPT (GUID Partition Table)
              S.M.A.R.T. Status: Verified
    The Boot Camp Drive is no longer listed.
    I assume this is due to the the fact that the drive is "In Use" however is seems odd since the Mac drive is also in use and it appears without problem. I assume there is no "fix" for this, I was just wondering if someone may have an explaination why?
    Also, I do realize that I can query the various interface types like system_profiler SPSerialATADataType to get all the properly installed phycial drives, but then I would have to query all possible interface types, isolate only devices containing Volumes, then consoldate the information to just the information that I need. I was hoping for a cleaner query.

    Thank you for your response.
    VMWare may be the cause, but the actual issue I am having is with Apple's System Information. I anticipated resistance from VMWare if I went to them with a question about an Apple software issue (even though VMWare software is part of the equation). I was trying to avoid the inevitable finger pointing game. I thought I would try with Apple Forums first since the issues presents itself within the Apple Software. However, you are correct that VMWare may have an explanation on why Fusion might be interfering with System Information. I will check with them next.
    To answer your question. Yes, In most cases I do use Fusion to run Windows side-by-side with the Mac OS. However, that is not always the case. There are a few reasons why I have it setup using a Dual Boot configuration.
    One, in some cases, due to the intense programs I occasionally run (graphic applications), I prefer to simply boot straight into Windows via Boot Camp so I may allocate all hardware resources to Windows. Additionally, some graphic applications like to have direct access to hardware and the extra layer of the VM environment can cause problems when an application is trying to directly access specific hardware like a graphics card.
    Second, I often use either side, both Mac and PC, for testing. There is an advantage to not having to rely on the Mac OS to run Windows. If, for whatever reason, my Mac becomes unstable due to testing, I can still jump right into Windows to do work if necessary.
    Third, I love the Mac OS, but I work in a PC centric organization. If there is a "problem" with my system, it is too easy for other system admins to say, "it's because it's a Mac". Having the definitive separation of the OS's allows me to prove that the Mac OS is not a factor.

  • System.out.println not working in Tomcat-4.1.x

    System.out.println not working in Tomcat-4.1.24. Any settings has to be enabled??? I am using tomcat for Solaris

    I think u can use ServletContext.log() to output info instased.

  • System Settings will not save my desired mouse scroll direction

    I understand the Apple genius of wanting the Settings: Mouse: Scroll direction: Natural box to be checked.  But **** it, this is MY iMac and I want the scroll direction to remain Unchecked, so the screen scrolls in the direction I’ve been used to for YEARS.
    The problem is the System Settings will not save the unchecked scroll box.  I have to return to the System Settings every time I log on to UN check the Scroll Direction: Natural box.
    Will Apple ever fix this so that I, and others, can operate the scrolling as THEIR LONG-TIME USER sees fit?

    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback
    Or you can use your Apple ID to register with this site and go the Apple BugReporter. Supposedly you will get an answer if you submit feedback.
    Feedback via Apple Developer
    Do a backup.
    Quit the application.
    Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J.  When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder.  Select Library. Then go to Preferences/com.apple.systempreferences.plist. Move the .plist to your desktop.
    Restart, open the application and test. If it works okay, delete the plist from the desktop.
    If the application is the same, return the .plist to where you got it from, overwriting the newer one.
    Thanks to leonie for some information contained in this.

  • Acrobat Reaader will not work before I accept End User License Agreement. But where and how?

    Acrobat Reaader will not work before I accept End User License Agreement. But where and how?
    Have installed version 9.5 on my Windows 7 desk-top computer.

    I don't know what you mean by "where and how"; Adobe Reader will automatically present the license agreement to accept the first time you use it.

  • Adobe Flash will not update to a W-2000 system and will not work? Is there a fix? Mozilla has disabled Flash. Do I have to go back to Explore?

    Adobe Flash will not update to a W-2000 system and will not work in Firefox? Is there a fix? Mozilla has disabled Flash. Do I have to go back to Explore?

    have you tried to install flash
    restart imac
    go to web site which require flash

  • System preferences will not open after Yosemite 10.10.2 upgrade

    system preferences will not open after Yosemite 10.10.2 upgrade.  What should I do?

    Reinstalling OS X Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall OS X: Select Reinstall OS X and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    Also see:
    Reinstall OS X Without Erasing the Drive
    Choose the version you have installed now:
    OS X Yosemite- Reinstall OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • My system preferences will not open!

    i have a Mac Mini and 10.6.8 and my system preferences will not open how do i solve this?

    What happens when you try?
    Try booting to Safe Mode
    OS X: What is Safe Boot, Safe Mode?
    After your try, open the Console app in the Utilities folder and at the time you tried look for log entry errors associated with the opening System Preferences and post them here.

Maybe you are looking for