0

I am running my java class as below and now I want kill this java process with out using PID. I want to use dharsha. Is this possible? If not tell how can I kill the java process programmatically or command in windows

start "dharsha" java Main
0

1 Answer 1

1

you can run a taskkill

taskkill /f /im javaw.exe
or
taskkill /f /im java.exe

I think this one is more efficient:

wmic process where "name like '%java%'" delete

For specific application:

FOR /F "tokens=1,2 delims= " %%G IN ('jps -l') DO IF %%H=myMainclass taskkill /F /PID %%G

//myMainClass stands for your application's main class
Sign up to request clarification or add additional context in comments.

3 Comments

if we runs many java process we can not this . I need kill only related to my work and also we can not delete using process id its randomly created by OS. and see there i have added process name but i not able get that and kill
Actually start names the window not the process, but taskkill can filter on that slightly less conveniently taskkill /f /fi "windowtitle eq dharsha"
@dave_thompson_085 I added something for specific application

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.