| Author |
run java .jar file on startup without user interfering
|
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
|
I would like to know how I could run a jar file every time I startup without any user interfering (such as placing the jar file in the startup folder).
|
 |
rakesh sugirtharaj
Ranch Hand
Joined: Dec 16, 2007
Posts: 151
|
|
|
May be I m still a beginner and I m not understanding the question, but what startup? What jar?
|
Cheers!
RSR
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Please do a search through the fora; a similar question comes up about once a month.
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
Originally posted by Devasia Manuel: I would like to know how I could run a jar file every time I startup without any user interfering (such as placing the jar file in the startup folder).
By startup, do you mean when the machine first starts up or when you actually log in ? Also what operating system are you using ?
|
Joanne
|
 |
Amit Ghorpade
Bartender
Joined: Jun 06, 2007
Posts: 2561
|
|
Originally posted by Campbell Ritchie: Please do a search through the fora; a similar question comes up about once a month.
Something like this one.
|
SCJP, SCWCD.
|Asking Good Questions|
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
That looks an excellent thread, Amit, thank you. Typical JavaRanch stuff. Two useful posts then it disintegrates into banter between the staff
|
 |
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
I am using the Windows XP OS, and when I mean startup, I mean every time the computer boots. For example, if I shut down the computer then reboot it, he jar file should run. I know how to do this quite easily by putting the jar file in the startup directory but I would like more advanced means of doing it. [ November 07, 2008: Message edited by: Devasia Manuel ]
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
|
You need to set your jar file up to run as a Windows Service. There are several programs that will do this for you. Search for Windows Services Wrapper
|
 |
Amit Ghorpade
Bartender
Joined: Jun 06, 2007
Posts: 2561
|
|
Originally posted by Campbell Ritchie: That looks an excellent thread, Amit, thank you. Typical JavaRanch stuff. Two useful posts then it disintegrates into banter between the staff
|
 |
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
|
Wouldn't all the methods listed above mean the user interfering...I am thinking more on the lines on letting java create a registry entry that would make the program run on startup. Is that possible with java?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
I think it means without the user having to take any action to start the application.
|
 |
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
|
I meant without the user having to do anything to start the application and make it run on startup
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Create a batch file that executes the java -jar myapp.jar command. Put this batch file in Window's Startup folder.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
Originally posted by Devasia Manuel: I meant without the user having to do anything to start the application and make it run on startup
What Joanne Neal said. Make the application into a service and configure it to run automatically. Yes, this probably requires some registry entries or something like that. But you don't need to use Java to set up the service.
|
 |
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
|
I think the batch file method looks more appealing to me...How exactly do I make a batch file that will allow me to run the program
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
Don't know. But try:and save it as Foo.bat.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
If it's a windowed application, creating a Windows shortcut may be a bit better. It's basically the same as the BAT file contents but replace java.exe with javaw.exe. This way no DOS box will be shown.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Good idea, Rob. I forgot about javaw.
|
 |
Devasia Manuel
Ranch Hand
Joined: May 13, 2008
Posts: 57
|
|
I get it now, I think I'll just stick to .bat files. Thanks for your help everybody!!!
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
You're welcome It's always nice to hear somebody has got their application to work.
|
 |
 |
|
|
subject: run java .jar file on startup without user interfering
|
|
|