randomgood
randomgood

Reputation: 566

Run a java program at startup in windows only after mysql is running?

I have a java program which uses Mysql database(using mysql which comes with Xaamp). I ve written batch script to start xaamp and run java program. How can i make sure that my java program is executed only after xaamp is up and running after startup? Or is there any alternatives, my constraint is that I can only use Mysql which comes with xaamp and i want a database entry at windows startup?

Upvotes: 0

Views: 315

Answers (3)

cafebabe1991
cafebabe1991

Reputation: 5176

add both of them to the task scheduler for WIN7 and cronjob in linux

hope it helps

Upvotes: 0

kpentchev
kpentchev

Reputation: 3090

Start both applications as windows services and configure the java app service to depend on the mysql service.

C:\Users\user>sc showsid "MySQL"

NAME: MySQL
SERVICE SID: S-1-5-80-3683700405-516785638-1234977990-1036077020-2941583457
STATUS: Inactive

C:\Users\user>sc showsid "MySQL" | FIND "STATUS:"
STATUS: Inactive

Upvotes: 4

Erik Pragt
Erik Pragt

Reputation: 14637

You could check if MySQL is running by checking the port it's running on, usually 3306, and build a retry mechanism for that, say, check every 10 seconds?

Upvotes: 0

Related Questions