2

I have java application say xxxx.exe. Which I manually kill that application, the corresponding Java.exe is still bound to the port, so that when I re-start my application. I cannot attach it to the port. When I check the log it says the connection is already established. JVM unable to bind?

When you kill the applicationname.exe, how would you force the corresponding java.exe file also to be killed?

5
  • 1
    How do you run your Java application? Do you use some native launcher? If so, which one? With which settings? Or are you simply running java.exe? Because usually a Java application should consist of a single process, which is usually java.exe or javaw.exe on Windows. Sep 5, 2011 at 7:09
  • Hi, I am running my java application on windows services. Ya java application consists of single process that is java.exe. but wat I was referring was that if I have more than one java application running in my system. With java.exe it is not possible to find for which application which java.exe belongs to. And while stopping the servicename.exe the java.exe is not getting disconnecting resulting in port still bounded. so when I re-start my application its not able to attach itsef to the port? So how do I get my port un-binded when the java application is stopped??
    – AKV
    Sep 6, 2011 at 3:21
  • Use jps.exe to find out which ? java.exe your program is. But my question is this: if your application consists only of a java.exe process, then what is the service.exe process that you're killing? Sep 6, 2011 at 6:10
  • Hi, I actually got your point. u leave the (service.exe) i was confused a bit.
    – AKV
    Sep 6, 2011 at 6:53
  • @Joachim. Could you explain how to use jps.exe to find out which java.exe i am using. thanks
    – AKV
    Sep 10, 2011 at 16:02

1 Answer 1

0

Your Java application is launching the JVM... therefore you should have access to the process ID of the new JVM. Post some code for us to have a better understanding of what's going on.

2
  • thanks for your comment. Its kind off restricted I cannot post my comment. I can explain you in detail. When I start a java application say myapplication.exe, the application will be launched along with java.exe being created. When i stop the services of myapplication.exe it also should disconnect the port. But in my case the port is still bounded even after shutting down the application.
    – AKV
    Sep 5, 2011 at 6:45
  • 1
    Yes but that code your using to launch the java.exe should return the PID of the process and you can then use that to terminate it upon exit...?
    – user400055
    Sep 5, 2011 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.