Operations 3 min read

How to Auto-Start a JAR on Windows After Reboot

This guide explains how to place a JAR file on a Windows server, create a batch script that runs the JAR, and configure the Windows Startup folder so the application launches automatically after the system restarts.

The Dominant Programmer
The Dominant Programmer
The Dominant Programmer
How to Auto-Start a JAR on Windows After Reboot

Scenario: Deploy a JAR on a Windows server and ensure it runs automatically after the machine reboots.

Implementation steps:

Choose a directory to store the JAR, e.g., D:\www\kaoqinBack, and copy the JAR (e.g., bdkqgl.jar) there.

Verify the JAR runs without errors: java -jar bdkqgl.jar Create a text file (e.g., badao.txt) with the following content:

@echo "公众号:霸道的程序猿"
java -jar d:\www\kaoqinBack\bdkqgl.jar

Save the file and rename its extension to .bat (e.g., badao.bat).

Double‑click the batch file to confirm it opens a command window, prints the text, and launches the JAR without errors.

Automatic startup configuration:

Open the Windows Startup folder, typically located at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp. If the folder is hidden, enable the display of hidden files.

If the folder does not exist (or is named in Chinese), create a StartUp (or equivalent) directory manually.

Copy the prepared badao.bat into this Startup directory.

After placing the batch file, Windows will execute it automatically on each boot, causing the JAR to start without manual intervention.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

automationWindowsstartupJARBatch file
The Dominant Programmer
Written by

The Dominant Programmer

Resources and tutorials for programmers' advanced learning journey. Advanced tracks in Java, Python, and C#. Blog: https://blog.csdn.net/badao_liumang_qizhi

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.