简体   繁体   English

如何使JAVA Applet自动运行?

[英]How to make a JAVA applet Autorun?

I have a JAVA project that updates a database. 我有一个更新数据库的Java项目。

But I have to manually run the project so the database becomes updated. 但是我必须手动运行项目,以便数据库更新。 And when I forget, it's just a pain in the ass, so my boss comes to me and starts to say a lot of things. 当我忘记时,这只是种痛苦,所以老板来找我,开始说很多话。

I want to export a .jar file that runs when Windows starts, checks if the database is updated, and, if not, update it. 我想导出一个在Windows启动时运行的.jar文件,检查数据库是否已更新,如果没有,则对其进行更新。

Is there any way to do that? 有没有办法做到这一点?

First, if you are not running in a browser, then you don't need an applet. 首先,如果您未在浏览器中运行,则不需要小程序。

Then there are two ways to do this: 然后,有两种方法可以做到这一点:

  • make a .bat file that calls java -jar \\path\\to\\your\\jar\\file.jar and place it in Start Menu > Programs > Startup (which is actually C:\\Documents and Settings\\<username>\\Start Menu\\Programs\\Startup 制作一个调用java -jar \\path\\to\\your\\jar\\file.jar.bat文件,并将其放置在“ Start Menu > Programs > Startup (实际上是C:\\Documents and Settings\\<username>\\Start Menu\\Programs\\Startup
  • install as service (but this is rather complicated) 作为服务安装(但这相当复杂)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM