Just learning..need some help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Just learning..need some help

  1. #1
    mike Guest

    Just learning..need some help


    Writing a VERY simple program. The question is when using the console for
    the application and you double click on it in windows it opens and runs the
    program then closes the console quickly. I want to make the console stay
    open. How is that done.

    Code example here ( not complete of all the code)

    System.out.print ...i know this has the information after it
    System.out.print ''
    System.out.print ''all these lines work perfectly

    System.in.wait()-- cant get this to work here.

    like i said the problem is right in front of me no doubt. just not use to
    java yet. Thanks

  2. #2
    MarkN Guest

    Re: Just learning..need some help


    When you say remain open do you mean even after the 'program' has ended?

    If so, open a dos window and run the 'program'. What are you clicking on
    -filename and extension?

    If not, use System.in.read();


    Mark


  3. #3
    Volker Held Guest

    Re: Just learning..need some help

    You can also change the links properties so the window stays open once
    the program ended - canīt tell step by step cause iīm running linux at work.
    Just right click the link and select properties - there is a many
    relating console behaviour - i just donīt remember right now

    Volker

    MarkN wrote:
    > When you say remain open do you mean even after the 'program' has ended?
    >
    > If so, open a dos window and run the 'program'. What are you clicking on
    > -filename and extension?
    >
    > If not, use System.in.read();
    >
    >
    > Mark
    >
    >




  4. #4
    Volker Held Guest

    Re: Just learning..need some help

    i meant

    ..... there is a tab relating console behaviour...

    Volker

    Volker Held wrote:
    > You can also change the links properties so the window stays open once
    > the program ended - canīt tell step by step cause iīm running linux at
    > work.
    > Just right click the link and select properties - there is a many
    > relating console behaviour - i just donīt remember right now
    >
    > Volker
    >
    > MarkN wrote:
    >
    >> When you say remain open do you mean even after the 'program' has ended?
    >>
    >> If so, open a dos window and run the 'program'. What are you clicking on
    >> -filename and extension?
    >>
    >> If not, use System.in.read();
    >>
    >>
    >> Mark
    >>
    >>

    >
    >




  5. #5
    Guest

    Re: Just learning..need some help


    G'day all

    Well Mike, I'm new to this stuff too (how's yesterday sound?)... well Java
    anyway.

    I tried out the wait method in a simple "Hi World" program and the thing
    ran (ie it wrote "Hi World") but then crashed with a "current thread not
    owner" error. Don't ask me what this means though. I'm assuming that this
    is what you got.

    I've also been having a poke around my JavaDoc files. To me, the .wait method
    seems unnecessary.

    Try leaving this line out completely. I can't see the benefit in having it
    in at all. My console stays open no worries. I also get a "Press any key
    to continue" message which is waiting for me to close the window.

    Hope this helps.

    Cheers

    Mike (another one)

    "mike" <ice_mike66@yahoo.com> wrote:
    >
    >Writing a VERY simple program. The question is when using the console for
    >the application and you double click on it in windows it opens and runs

    the
    >program then closes the console quickly. I want to make the console stay
    >open. How is that done.
    >
    >Code example here ( not complete of all the code)
    >
    > System.out.print ...i know this has the information after it
    > System.out.print ''
    > System.out.print ''all these lines work perfectly
    >
    > System.in.wait()-- cant get this to work here.
    >
    >like i said the problem is right in front of me no doubt. just not use to
    >java yet. Thanks



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center