Hi I have a java program that kind of runs in the background (it mainly controled from a menu on a system tray icon) I've made it so that my java application runs when you click on a bat file from the start menu. However, this just starts another instance of the application.
Is it possible for the bat file to check if the applicaiton is allready running, and if so, to make the application show its GUI instead?
You can use sockets. Open a socket on a specific port from your Java application. From your application check whether the socket is already bound or not. If the port is free, then the application is not running. If it is already bound, it means another instance is running, so handle it appropriatly.
You can also use JNDI to register your application, if you can afford it.
posted 14 years ago
cheers for that
New rule: no elephants at the chess tournament. Tiny ads are still okay.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop