Class ProcessUtils

java.lang.Object
com.luna.common.os.ProcessUtils

public class ProcessUtils extends Object
Author:
isluna
  • Constructor Details

    • ProcessUtils

      public ProcessUtils()
  • Method Details

    • getProcesses

      public static List<oshi.software.os.OSProcess> getProcesses()
      获取所有进程
      Returns:
    • getProcessesByFileName

      public static List<oshi.software.os.OSProcess> getProcessesByFileName(String fileName)
      获取所有进程,用filename过滤
      Parameters:
      fileName -
      Returns:
    • getProcessesByPath

      public static List<oshi.software.os.OSProcess> getProcessesByPath(String path)
    • formatPath

      public static String formatPath(String path)
      格式化路径,\替换为/
      Parameters:
      path -
      Returns:
    • removeExtension

      public static String removeExtension(String filename)
    • killProcessGracefully

      public static void killProcessGracefully(Process process, String fileName)
    • osKill

      public static void osKill(String fileName)
    • osKill

      public static void osKill(int processId)
      操作系统级别杀进程
      Parameters:
      processId -
    • getProcessesAndKill

      public static void getProcessesAndKill(String path)
      根据path查找进程并kill
      Parameters:
      path -