Java App fail to run twice

J

Johnny

I just wrote a program that take a text file and runs fine the first
time but as I input another file and run it again it freezes in the
middle of my scanner method. Don't know why..

ps I did close the scanner after the first run
 
M

markspace

Johnny said:
I just wrote a program that take a text file and runs fine the first
time but as I input another file and run it again it freezes in the
middle of my scanner method. Don't know why..

ps I did close the scanner after the first run


I think we're going to need an SSCCE to help you with that one:

http://sscce.org/

Short, Self Contained, Correct (Compilable), Example

* Short (Small) - Minimise bandwidth for your example, do not bore
the audience.
* Self Contained - Ensure everything is included, ready to go.
* Correct - Copy, paste, compile, see-the-error is the aim.
* Example - Displays the problem you are trying to solve.
 
N

Newbie

Perhaps that would depend on the code you did not
show us.  How about posting an SSCCE*?



Good, good..  BTW - did you have a question?


I got it fixed, forgot to cancel old thread.
 
R

Roedy Green

I got it fixed, forgot to cancel old thread.

That should not matter. Once you exit those old threads are gone, no?
Was it still running when you started again?
--
Roedy Green Canadian Mind Products
http://mindprod.com

If everyone lived the way people do in Vancouver, we would need three more entire planets to support us.
~ Guy Dauncey
 
D

Donkey Hottie

Roedy Green said:
That should not matter. Once you exit those old threads
are gone, no? Was it still running when you started again?

That's what I though too, at first. Then it occurred to me that he maybe
meant the news-thread. He forgot to cancel the original post..

Maybe.
 
N

Newbie

That's what I though too, at first. Then it occurred to me that he maybe
meant the news-thread. He forgot to cancel the original post..

Maybe.

No i meant the new thread from the program, because my program never
exits out, it suppose to be able to run over and over again without
exiting. Originally I am running a swing worker in the background
therefore when the first run is done i forgot to cancel or done that
thread and when i run the program the second time the worker starts
another thread. Two parellel thread running using the same scanner.
Thats when it messes up, therefore when I cancel the first thread
after the first run, everything is fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top