Run Java application at Windows startup

shan picture shan · May 10, 2011 · Viewed 89k times · Source

I have a JAR file containing a Java application. How can I make it start with Windows, without needing user interaction?

Answer

MikeKusold picture MikeKusold · May 10, 2011

Create a .bat file and put this inside:

javaw -Xmx200m -jar C:\Path\to\jarfile\TheJar.jar

Then put the .bat file into the windows startup folder.

One more thing: There's a difference between using java and javaw. While java is better when you are debugging an application, the application prints text or something like that, javaw is better when you don't need that. Why? Because java runs java program using a console that shows all that application prints (println's, exception stacktraces and so on) while javaw doesn't run on console.