且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将JAVA程序作为计划任务运行

更新时间:2023-02-17 21:12:45

我认为您可以创建一个简单的批处理脚本,以这种方式启动您的程序:

I Think that you could create a simple batch script that will launch your program in this way :

@echo off
REM Eventually change directory to the program directory 
cd C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\
REM run the program
"C:\Program Files\Java\jdk1.7.0\bin\java.exe" -jar "C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\Facebook.jar"

将其复制到记事本中并保存作为java_script.cmd,然后直接安排这个脚本而不是程序。

Copy it into the notepad and save as java_script.cmd and then schedule this script instead of the program directly.