RUVIDEO
Поделитесь видео 🙏

Unix & Linux: Kill only one Java process (6 Solutions!!)

📁 Обучение 👁️ 18 📅 05.12.2023

Unix & Linux: Kill only one Java process


The Question: I usually run few Java applications, one for server running locally and other
for some IDE like NetBeans. And from time to time, after lots of redeployments,
my server get stuck on OutOfMemoryException so I need to kill Java process in
order to reboot.
So I do pkill -9 java but this also kills my running IDE which I don't want to.
So how do I kill only application linked to running server and not the other
ones?I assume that they all are running under same process but there has to be
some way how to distuingish them.

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

== This solution helped 27 people ==
For killing a process that is associated with multiple processes, you need to
kill that by using process id associated with that process.
To get the process id of that java process run
ps -A |grep java
output of this command will give the list of java processes running on your
system. Note down Process ID (PID) of that process whom you want to kill and
run
kill -9 PID

== This solution helped 8 people ==
Instead of using ps and grep, you can use ps's -C flag to select all commands
listed with the name 'java'. You may also want to use ps's -f flag to print the
full command name of each listed process. That way, you can see what each java
process is actually doing. Here is the command in full: ps -fC java.
You could also use pgrep to list all java processes. pgrep -a java will return
the PID and full command line of each java process.
Once you have the PID of the command you wish to kill, use kill with the -9
(SIGKILL) flag and the PID of the java process you wish to kill. Java doesn't
always stop when it receives a 'SIGTERM' signal (processes are allowed to
handle 'SIGTERM'), so sending it the 'SIGKILL' signal, which makes init kill
the program without warning it first, is often necessary.
For example, if ps -fC java returns
UID PID PPID C STIME TTY TIME CMD
jeff 9014 8890 0 08:51 pts/0 00:00:00 java IDE
jeff 11775 8890 6 08:59 pts/0 00:00:00 java TestProgram
or psgrep -a java returns
9014 java IDE
11775 java TestProgram
and you wish to kill java TestProgram, you should run kill -9 11775.

With thanks & praise to God, and with thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to user Petr Mensik (https://unix.stackexchange.com/users/16647), user P4cK3tHuNt3R (https://unix.stackexchange.com/users/32224), user Nikhil VJ (https://unix.stackexchange.com/users/249209), user Muhammad Gelbana (https://unix.stackexchange.com/users/25989), user Marek R (https://unix.stackexchange.com/users/31736), user manatwork (https://unix.stackexchange.com/users/10412), user Alexis Wilke (https://unix.stackexchange.com/users/57773), and the Stack Exchange Network (http://unix.stackexchange.com/questions/64623). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything is amiss at Roel D.OT VandePaar A.T gmail.com.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Unix & Linux: Kill only one Java process (6 Solutions!!)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.