Package com.luna.common.os
Class ProcessUtils
java.lang.Object
com.luna.common.os.ProcessUtils
- Author:
- isluna
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatPath
(String path) 格式化路径,\替换为/static List<oshi.software.os.OSProcess>
获取所有进程static void
getProcessesAndKill
(String path) 根据path查找进程并killstatic List<oshi.software.os.OSProcess>
getProcessesByFileName
(String fileName) 获取所有进程,用filename过滤static List<oshi.software.os.OSProcess>
getProcessesByPath
(String path) static void
killProcessGracefully
(Process process, String fileName) static void
osKill
(int processId) 操作系统级别杀进程static void
static String
removeExtension
(String filename)
-
Constructor Details
-
ProcessUtils
public ProcessUtils()
-
-
Method Details
-
getProcesses
获取所有进程- Returns:
-
getProcessesByFileName
获取所有进程,用filename过滤- Parameters:
fileName
-- Returns:
-
getProcessesByPath
-
formatPath
格式化路径,\替换为/- Parameters:
path
-- Returns:
-
removeExtension
-
killProcessGracefully
-
osKill
-
osKill
public static void osKill(int processId) 操作系统级别杀进程- Parameters:
processId
-
-
getProcessesAndKill
根据path查找进程并kill- Parameters:
path
-
-