我需要帮助才能在特定时间(例如下午 2 点)在服务器上运行我的 Java 程序(以索引新文件)。
有人告诉我 Java 有一些叫做工作的东西,但我不知道如何使用它。我试过这个:
boolean cond=true;
while(cond){
@SuppressWarnings("deprecation")
int heur = new Date().getHours();
@SuppressWarnings("deprecation")
int minute= new Date().getMinutes();
if(heur==16 && minute==02){
indexer.close();
end = new Date().getTime();
File f;
cond=false;
}
但是有了这个程序仍在运行。
如何在指定时间运行我的程序?