Code for automatically launching a java application when Windows starts

Possible duplicate:
Autostart for java desktop application?

I have a Java desktop application using netbeans 6.5.1. I was wondering if anyone could help me suggest a code to automatically process the Jar file when Windows starts.

Thanks in advance Bhavi

+2
source share
2 answers

It depends on what you mean by Windows Startup. By running it in the background without a user logging in, you have to create a Windows Service wrapper.

If “Starting Windows” means “start when the user logs in”, create a batch file that launches your application and place the link to this batch file in the “Autostart of user” folder (or in the “Autostart of all users” folder )

EDIT To clarify what I mean according to your comments.

You said you are a .NET programmer, so we can just talk as if you were developing a .NET application:

  • If your program should behave like a Windows service, you will need some kind of service wrapper that acts like a “real” Windows service and runs your program when it starts using the Service Manager (you cannot currently develop a Windows service in Java, so you need this shell).

  • If your program should behave like a regular application and just run whenever a user logs in (for example: Skype or WinAmp agent), you just need to run your program by placing a link to it to the user AutoStart folder.

In case 1), you will need to follow the answers of other posters - I have never done this before, but I am sure that this can be done. (Perhaps this link will help you: http://edn.embarcadero.com/article/32068 )

In case 1), simply create a batch file that launches your application, and create a link to this batch file in the autorun folder of the user / all users.

+3
source

We use Windows-Tomcat tomcat6w.exe (renamed OurApplication.exe) to create a service for our Java application. Then we just set it to autorun.

+1
source

Source: https://habr.com/ru/post/1333840/


All Articles