Check if Glassfish DAS is running programmatically

后端 未结 3 866
南笙
南笙 2021-01-16 06:52

How to check if Glassfish DAS is running programmatically even if it is deployed on local machine or remote machine?

Using Java6

3条回答
  •  -上瘾入骨i
    2021-01-16 07:24

    This is how you would normally check that glassfish is up and running:

    enter image description here

    But since you want to run it programmaticaly, what you can do is create an script and execute the script from the code with java.

    try{
    Runtime.getRuntime().exec("Path to my script");
    } 
    catch(IOException e) {
    System.out.println("exception");
    }
    

    If you are in linux, you could also create an script to grep for the glassfish process.

提交回复
热议问题