aspose file tools*
The moose likes Beginning Java and the fly likes Why jar console program cannot run? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why jar console program cannot run? " Watch "Why jar console program cannot run? " New topic
Author

Why jar console program cannot run?

Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
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.

Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Andrew Parker
Ranch Hand

Joined: Nov 12, 2001
Posts: 178
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

Joined: Dec 10, 2001
Posts: 7023
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

Joined: Dec 10, 2001
Posts: 7023
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

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Intermediate forum...
[ August 25, 2004: Message edited by: Dirk Schreckmann ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why jar console program cannot run?