• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why jar console program cannot run?

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I built a console application on windows. It works fine when I run it on JBuilder. It has a timer to run the Socket Connection with another server and exchange data for every minute.

I built the archives - both native executable jar file and console exe file.

I run it in console window. It can display the first print line of the program: "Starting Data Exchange ..."

However, I did not see the data updating in both servers.

The console program seems running from connecting to local DB till printing out Starting Data Exchange ...

I am not sure whether the code insides the timertask has run or not. It is ok when I run it in JBuilder.

So, is it the timer bug or the classpath issue?

What may be the deployment problems?

Thanks for any kind advice.

 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew, you've posted a most incomplete code example. Also, I'm thinking that this might be a bit beyond the beginner level we aim for in this forum.

So, how about some more complete code and then we figure out a better forum for this conversation?
 
Andrew Parker
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it is complete code in main method. except

main.DBConnection();
main.dataexchange();

I added println in the above 2 methods to check whether they are executed and I did not see the println. Do you think it is the timer issue?

If I placed in the wrong forum, can you help me move to the proper level?

Thanks for help.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's more than those two things missing from your posted code. Did you even try it?

At any rate, perhaps the following excerpt from the Timer class documentation helps to shed some light on your troubles.

After the last live reference to a Timer object goes away and all outstanding tasks have completed execution, the timer's task execution thread terminates gracefully (and becomes subject to garbage collection).

 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See what the following code does, if you don't close that JOptionPane, and just let it sit there for some time more than 60 seconds.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the Intermediate forum...
[ August 25, 2004: Message edited by: Dirk Schreckmann ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic