How can I automatically re-open a program if it terminates / closes / crashes?
I've created a Java JAR program that needs to be running all the time in the computer. If the program is closed (either because the user closed it or because it crashed), I need to reopen the program.
I already managed to autostart it whenever I log in the computer, but how can I keep it alive?
I'm not sure whether this should be a programming question or not. After all, auto-starting programs is not a programming question, so I figured that making them persistent could be a similar case.
windows java
add a comment |
I've created a Java JAR program that needs to be running all the time in the computer. If the program is closed (either because the user closed it or because it crashed), I need to reopen the program.
I already managed to autostart it whenever I log in the computer, but how can I keep it alive?
I'm not sure whether this should be a programming question or not. After all, auto-starting programs is not a programming question, so I figured that making them persistent could be a similar case.
windows java
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18
add a comment |
I've created a Java JAR program that needs to be running all the time in the computer. If the program is closed (either because the user closed it or because it crashed), I need to reopen the program.
I already managed to autostart it whenever I log in the computer, but how can I keep it alive?
I'm not sure whether this should be a programming question or not. After all, auto-starting programs is not a programming question, so I figured that making them persistent could be a similar case.
windows java
I've created a Java JAR program that needs to be running all the time in the computer. If the program is closed (either because the user closed it or because it crashed), I need to reopen the program.
I already managed to autostart it whenever I log in the computer, but how can I keep it alive?
I'm not sure whether this should be a programming question or not. After all, auto-starting programs is not a programming question, so I figured that making them persistent could be a similar case.
windows java
windows java
asked Jul 19 '15 at 7:50
OmegaOmega
1992517
1992517
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18
add a comment |
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18
add a comment |
3 Answers
3
active
oldest
votes
Put this into a .bat
/.cmd
file. Adjust the java
invocation to your needs. Start the cmd file from autostart.
Make sure to use java
, not javaw
, since you want to wait until it's finished before starting it the next time.
:start
"C:Program Filesjavabinjava" -jar my.jar
goto start
add a comment |
There are several program you can use for this. One is called Control Running Programs (CRP). This is a very good tool to use when having this problem.
Here's a link for that............
https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/
Hope this answers your question, if not let me know.
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
add a comment |
There is a question over at stack overflow about how to turn a .bat file into a service:
https://stackoverflow.com/a/13294293
The top answer to that question is to use nssm (http://nssm.cc/). When your bat file is made into a service it will automatically restart when it closes.
Usage for your purpose would be something like the following within an administrator prompt:
nssm install yourservicename yourbatfile.bat
nssm start servicename
nssm stop servicename
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f942455%2fhow-can-i-automatically-re-open-a-program-if-it-terminates-closes-crashes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Put this into a .bat
/.cmd
file. Adjust the java
invocation to your needs. Start the cmd file from autostart.
Make sure to use java
, not javaw
, since you want to wait until it's finished before starting it the next time.
:start
"C:Program Filesjavabinjava" -jar my.jar
goto start
add a comment |
Put this into a .bat
/.cmd
file. Adjust the java
invocation to your needs. Start the cmd file from autostart.
Make sure to use java
, not javaw
, since you want to wait until it's finished before starting it the next time.
:start
"C:Program Filesjavabinjava" -jar my.jar
goto start
add a comment |
Put this into a .bat
/.cmd
file. Adjust the java
invocation to your needs. Start the cmd file from autostart.
Make sure to use java
, not javaw
, since you want to wait until it's finished before starting it the next time.
:start
"C:Program Filesjavabinjava" -jar my.jar
goto start
Put this into a .bat
/.cmd
file. Adjust the java
invocation to your needs. Start the cmd file from autostart.
Make sure to use java
, not javaw
, since you want to wait until it's finished before starting it the next time.
:start
"C:Program Filesjavabinjava" -jar my.jar
goto start
answered Jul 19 '15 at 8:11
Guntram BlohmGuntram Blohm
47226
47226
add a comment |
add a comment |
There are several program you can use for this. One is called Control Running Programs (CRP). This is a very good tool to use when having this problem.
Here's a link for that............
https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/
Hope this answers your question, if not let me know.
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
add a comment |
There are several program you can use for this. One is called Control Running Programs (CRP). This is a very good tool to use when having this problem.
Here's a link for that............
https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/
Hope this answers your question, if not let me know.
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
add a comment |
There are several program you can use for this. One is called Control Running Programs (CRP). This is a very good tool to use when having this problem.
Here's a link for that............
https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/
Hope this answers your question, if not let me know.
There are several program you can use for this. One is called Control Running Programs (CRP). This is a very good tool to use when having this problem.
Here's a link for that............
https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/
Hope this answers your question, if not let me know.
answered Jul 19 '15 at 7:59
eric24geric24g
11
11
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
add a comment |
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
Please read How do I recommend software for some tips as to how you should go about recommending software. At the very least you should provide more than just a link, for example some additional information about the software itself, for example how it can be used to solve the problem in the question.
– DavidPostill♦
Jul 19 '15 at 10:00
add a comment |
There is a question over at stack overflow about how to turn a .bat file into a service:
https://stackoverflow.com/a/13294293
The top answer to that question is to use nssm (http://nssm.cc/). When your bat file is made into a service it will automatically restart when it closes.
Usage for your purpose would be something like the following within an administrator prompt:
nssm install yourservicename yourbatfile.bat
nssm start servicename
nssm stop servicename
add a comment |
There is a question over at stack overflow about how to turn a .bat file into a service:
https://stackoverflow.com/a/13294293
The top answer to that question is to use nssm (http://nssm.cc/). When your bat file is made into a service it will automatically restart when it closes.
Usage for your purpose would be something like the following within an administrator prompt:
nssm install yourservicename yourbatfile.bat
nssm start servicename
nssm stop servicename
add a comment |
There is a question over at stack overflow about how to turn a .bat file into a service:
https://stackoverflow.com/a/13294293
The top answer to that question is to use nssm (http://nssm.cc/). When your bat file is made into a service it will automatically restart when it closes.
Usage for your purpose would be something like the following within an administrator prompt:
nssm install yourservicename yourbatfile.bat
nssm start servicename
nssm stop servicename
There is a question over at stack overflow about how to turn a .bat file into a service:
https://stackoverflow.com/a/13294293
The top answer to that question is to use nssm (http://nssm.cc/). When your bat file is made into a service it will automatically restart when it closes.
Usage for your purpose would be something like the following within an administrator prompt:
nssm install yourservicename yourbatfile.bat
nssm start servicename
nssm stop servicename
answered Jan 4 at 5:09
user112770user112770
101
101
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f942455%2fhow-can-i-automatically-re-open-a-program-if-it-terminates-closes-crashes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
To be sure here, what is the command used to start-up this java jar program now? what is your method of starting it at log-in? the worlds simplest method would be to use "Start /Wait" methods of running it , and just repeat that in a batch or have an infinite loop. It would help to know first though how your already doing this and with what exact command structure. Are you positive that when it crashes the executable fully terminates?
– Psycogeek
Jul 19 '15 at 7:58
@Psycogeek it's just a .bat file in the startup folder as described here: stackoverflow.com/a/5953583/555690
– Omega
Jul 19 '15 at 9:18