wood burning stoves 2.0*
The moose likes Java in General and the fly likes how to automatically lunch my app when windows boots? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to automatically lunch my app when windows boots?" Watch "how to automatically lunch my app when windows boots?" New topic
Author

how to automatically lunch my app when windows boots?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

what efforts i can make so that my java application automatically starts when windows(OS) start or boots ?
but solutions should be 100% programmatically , can any one has any idea about this ?


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

naved momin wrote:what efforts i can make so that my java application automatically starts when windows(OS) start or boots ?


Sounds like you want it to be a Service. Google for java windows service, or look into Tanuki Service Wrapper.

but solutions should be 100% programmatically


If you mean what I think you mean by that, then it's not possible.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Jeff Verdegan wrote:

but solutions should be 100% programmatically


If you mean what I think you mean by that, then it's not possible.


He could go and get a job for microsoft, and make everyone's computer start it at runtime
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Wendy Gibbons wrote:
Jeff Verdegan wrote:

but solutions should be 100% programmatically


If you mean what I think you mean by that, then it's not possible.


He could go and get a job for microsoft, and make everyone's computer start it at runtime


You'd think by now I'd know better than to use absolutes around a bunch of programmers.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Alternatively, you can put a .bat file that starts the app in the AutoStart folder.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3573
    
  14

Or just put a symbolic link there.
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

Tim Moores wrote:Alternatively, you can put a .bat file that starts the app in the AutoStart folder.

yes that could be one solution but that require human intervention, i m finding solution programmatically
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

naved momin wrote:
Tim Moores wrote:Alternatively, you can put a .bat file that starts the app in the AutoStart folder.

yes that could be one solution but that require human intervention, i m finding solution programmatically


Define exactly what you mean by "programmatically." A .bat file is a programmatic approach, in my opinion.

If you mean what I think you mean--simply by what you put in your Java code--then it is not possible.
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
Jeff Verdegan wrote:
naved momin wrote:
Tim Moores wrote:Alternatively, you can put a .bat file that starts the app in the AutoStart folder.

yes that could be one solution but that require human intervention, i m finding solution programmatically


Define exactly what you mean by "programmatically." A .bat file is a programmatic approach, in my opinion.

If you mean what I think you mean--simply by what you put in your Java code--then it is not possible.




Hypothetically, you could have your Java program create the batch file in the startup directory. So only an initial run of the program would be required. Just my two cents.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Philip Thamaravelil wrote:
Jeff Verdegan wrote:
naved momin wrote:
Tim Moores wrote:Alternatively, you can put a .bat file that starts the app in the AutoStart folder.

yes that could be one solution but that require human intervention, i m finding solution programmatically


Define exactly what you mean by "programmatically." A .bat file is a programmatic approach, in my opinion.

If you mean what I think you mean--simply by what you put in your Java code--then it is not possible.




Hypothetically, you could have your Java program create the batch file in the startup directory. So only an initial run of the program would be required. Just my two cents.


but would that be an installer step
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

I'd say you should make your app a service, as Jeff suggested. You could then use for example MakeMSI to create Windows Installer file (.msi) and have the service registered by it.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Can use Java Service Wrapper(32bit) or YAJSW(64bit). Old thread
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

Philip Thamaravelil wrote:
Jeff Verdegan wrote:
naved momin wrote:
Tim Moores wrote:Alternatively, you can put a .bat file that starts the app in the AutoStart folder.

yes that could be one solution but that require human intervention, i m finding solution programmatically


Define exactly what you mean by "programmatically." A .bat file is a programmatic approach, in my opinion.

If you mean what I think you mean--simply by what you put in your Java code--then it is not possible.




Hypothetically, you could have your Java program create the batch file in the startup directory. So only an initial run of the program would be required. Just my two cents.

thats nice one ....good job...
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

naved momin wrote:
Philip Thamaravelil wrote:Hypothetically, you could have your Java program create the batch file in the startup directory. So only an initial run of the program would be required. Just my two cents.

thats nice one ....good job...

A shortcut (.lnk) pointing to javaw.exe with proper arguments might be better, you probably don't want to display the console to the user. Making it would be a bit harder, though. In either case, you need to obtain the right location of the startup folder from Windows. Its location is not present (as of Windows 7) in environment variables and the name depends (among other things) on the version and language of the system. For both of these task you'll probably have to call Windows system functions, should be doable with JNA.

However, you stated you wanted your program to run when Windows boot. This solution would run it when a user logs in. These are different things.

I've already mentioned MakeMSI. I was able to produce my first msi file in about two days, though I didn't know virtually anything about Windows Installer beforehand. MSI would easily allow you to create the shortcut in startup folder during the installation, without having to bother about the exact location of that folder. Also, chances are that a MSI package will function better on newer Windows versions, where User Account Control is in place.

If you go the other way, make sure to provide ways to cleanly uninstall your program again. You don't want to alienate your users.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to automatically lunch my app when windows boots?
 
Similar Threads
On windows - One CPU , Two Monitors, Two kwyboards, Two mouse
How to make AXIS start a class each time it starts?
Weblogic out of box EJB example fails
WA #1.....word association
Incomming call and Midlet