Vmware 通过Sigar中进程名称的一部分获取进程ID

Vmware 通过Sigar中进程名称的一部分获取进程ID,vmware,java,sigar,Vmware,Java,Sigar,我正在使用获取进程ID并监视它 我有一个进程,它可以根据运行该进程的应用程序的版本更改名称。 例如: myProcess64.exe myProcess65.exe 是否有一种使用Sigar通过指定类似myProcess%的内容来获取进程Id的方法 现在我用的是: ProcessFinder find = new ProcessFinder(this.sigar); long[] pids = find.find("Exe.Name.ct=" + this.processName); 我一直尝

我正在使用获取进程ID并监视它

我有一个进程,它可以根据运行该进程的应用程序的版本更改名称。 例如:

myProcess64.exe myProcess65.exe 是否有一种使用Sigar通过指定类似myProcess%的内容来获取进程Id的方法

现在我用的是:

ProcessFinder find = new ProcessFinder(this.sigar);
long[] pids = find.find("Exe.Name.ct=" + this.processName);
我一直尝试使用常规表达式,但没有成功:

//getting the process with name "Photoshop.exe" (not working currently)
long[] pids = find.find("Exe.Name.re=^Photo(.)*.exe$);
Name返回运行进程的路径,而不仅仅是进程的名称

因此,正则表达式应如下所示:

long[] pids = this.find.find("Exe.Name.re=^.*\\\\Photo(.)*.exe$");