如何使用Java代码获取当前正在运行的应用程序名称? [英] How can I get the current running application names using java code ?

查看:2143
本文介绍了如何使用Java代码获取当前正在运行的应用程序名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行任务.我想获取当前正在运行的应用程序名称的名称(与任务管理器"中应用程序"选项卡中的名称相同).我想要Java中的代码.谁能帮我吗?

I am in the middle of a task. I want to get the names of the current running application names[which is the same as there in "Applications" tab in the Task Manager] in Windows. I want the code in java. Can anyone please help me ?

推荐答案

我不确定Java是否具有可以为您完成此操作的类,因此您需要尝试以下三种方法之一: br/>
1.使用Windows tasklist程序获取列表并将其输出通过管道传输到Java应用程序中.

2.使用 Java Native Access [ ^ ]库连接到Windows
I am not sure that Java has a class that will do this for you so you would need to try one of three options:

1. Use the Windows tasklist program to get the list and pipe its output into your Java app.

2. Use the Java Native Access[^] library to interface to the Windows EnumProcesses[^] function to get the details.

3. Write a C++ library to get the details you want (from EnumProcesses) and access it via JNI.


这篇关于如何使用Java代码获取当前正在运行的应用程序名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆