aspose file tools*
The moose likes Threads and Synchronization and the fly likes thread do not die Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "thread do not die" Watch "thread do not die" New topic
Author

thread do not die

Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
dear all,

Please help me out, I'm facing one issue i.e I've java application exe. I'm running that Exe and when i log off. the process will be killed.

Please help me, how could i manage, so that the process do not die, when end user log off.


Regards,
Amardeep
Gerbrand van Dieijen
Ranch Hand

Joined: Nov 28, 2008
Posts: 30
I'm not entirely sure about your problem. Do you have a java application, that is executed by running a class with a main method? The JVM will then be terminated when the main method exists and there's no other (non deamon) thread running.
To clarify: if you open a Swing or AWT window, there will always be an extra running thread, as Swing or AWT will spawn one seperate thread (to handle events and do graphic updates).

If your program exists, this is probably because it has finished doing everything it has to do.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42601
    
  65
You need to turn that application into a system service, instead of running it as a user-level application. Searching for "java application as a service" or similar will find solutions to this.


Ping & DNS - my free Android networking tools app
Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
Gerbrand van Dieijen wrote:I'm not entirely sure about your problem. Do you have a java application, that is executed by running a class with a main method? The JVM will then be terminated when the main method exists and there's no other (non deamon) thread running.
To clarify: if you open a Swing or AWT window, there will always be an extra running thread, as Swing or AWT will spawn one seperate thread (to handle events and do graphic updates).

If your program exists, this is probably because it has finished doing everything it has to do.



Dear Gerbrand,

I've one Application which contain java main i.e. p.s.v.main() that I've made one executable jar file through Jar2Exe. and when I run that Application it is running fine, also I'm able to task manager that application is running using my computer name. but when I log off from my account, that process is also killed. I don't want that. What I want that process will run if I logged off.

Hope, you may me out of this issue.


Regards,
Amardeep
Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
Ulf Dittmer wrote:You need to turn that application into a system service, instead of running it as a user-level application. Searching for "java application as a service" or similar will find solutions to this.



Dear Ulf Dittmer,

Please let me know how to do that? I really need it.

Regards,
Amardeep
Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
Amardeep Salkar wrote:
Ulf Dittmer wrote:You need to turn that application into a system service, instead of running it as a user-level application. Searching for "java application as a service" or similar will find solutions to this.



Dear Ulf Dittmer,

Please let me know how to do that? I really need it.

Regards,
Amardeep



I'm also getting lots of software for the same but all of them try version. I've no idea how they make that. I mean what logic do they apply for making such kind of software.

Regards,

Amardeep
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42601
    
  65
Some of those solutions are open source -like Java Service Wrapper-, so you can analyze what they do. You may also want to read up on what a "Windows Service" is and a "Unix cron job".
Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
Ulf Dittmer wrote:Some of those solutions are open source -like Java Service Wrapper-, so you can analyze what they do. You may also want to read up on what a "Windows Service" is and a "Unix cron job".


Dear Ulf Dittmer,

Hope I'll get some solution, Well I'll try first.

If i succeed then I'll let you know.
else also I'll let you guys know.


Thanks Ulf,

Amardeep Salkar

Gerbrand van Dieijen
Ranch Hand

Joined: Nov 28, 2008
Posts: 30
Amardeep Salkar wrote:
Gerbrand van Dieijen wrote:I'm not entirely sure about your problem. Do you have a java application, that is executed by running a class with a main method? The JVM will then be terminated when the main method exists and there's no other (non deamon) thread running.
To clarify: if you open a Swing or AWT window, there will always be an extra running thread, as Swing or AWT will spawn one seperate thread (to handle events and do graphic updates).

If your program exists, this is probably because it has finished doing everything it has to do.



Dear Gerbrand,

I've one Application which contain java main i.e. p.s.v.main() that I've made one executable jar file through Jar2Exe. and when I run that Application it is running fine, also I'm able to task manager that application is running using my computer name. but when I log off from my account, that process is also killed. I don't want that. What I want that process will run if I logged off.

Hope, you may me out of this issue.


Regards,
Amardeep


By Logging off, do you mean logging off Windows ? In that case, as told in the other postings, you have to install your application as a windows service. Creating a windows service is not as hard as it may seem.
See Google for a start:
http://www.google.nl/search?q=install+java+service

Basically, the java application is wrapped and then available as a service. That service will become active when Windows starts (not when you login). You'll be able to see an overview of currently installed services at:
Configuration screen, Administrative Tools, Services.


Amardeep Salkar
Ranch Hand

Joined: May 22, 2008
Posts: 46
Gerbrand van Dieijen wrote:
Amardeep Salkar wrote:
Gerbrand van Dieijen wrote:I'm not entirely sure about your problem. Do you have a java application, that is executed by running a class with a main method? The JVM will then be terminated when the main method exists and there's no other (non deamon) thread running.
To clarify: if you open a Swing or AWT window, there will always be an extra running thread, as Swing or AWT will spawn one seperate thread (to handle events and do graphic updates).

If your program exists, this is probably because it has finished doing everything it has to do.



Dear Gerbrand,

I've one Application which contain java main i.e. p.s.v.main() that I've made one executable jar file through Jar2Exe. and when I run that Application it is running fine, also I'm able to task manager that application is running using my computer name. but when I log off from my account, that process is also killed. I don't want that. What I want that process will run if I logged off.

Hope, you may me out of this issue.


Regards,
Amardeep


By Logging off, do you mean logging off Windows ? In that case, as told in the other postings, you have to install your application as a windows service. Creating a windows service is not as hard as it may seem.
See Google for a start:
http://www.google.nl/search?q=install+java+service

Basically, the java application is wrapped and then available as a service. That service will become active when Windows starts (not when you login). You'll be able to see an overview of currently installed services at:
Configuration screen, Administrative Tools, Services.






Dear Gerbrand,

I'll try my best for same, and let you know if I'm successfully!

I got some thing from that link which you have sent it to me. Thanks brother.
Let me implement that and then I'll let you know.

Thanks & Regards,

Amardeep salkar
 
 
subject: thread do not die