Bogdan
Bogdan

Reputation: 29

Use java to find GPU specifications on windows

I know that are many questions regarding of getting OS level information, I came through almost all of them, but I did not find something related to the gpu. I used System.getProperties, Runtime class and System.getenv. Thank you! Edited: I search for a windows solution

Upvotes: 1

Views: 583

Answers (1)

Shashwat
Shashwat

Reputation: 2352

Try below code :

String line;
Process p = Runtime.getRuntime().exec("wmic PATH Win32_videocontroller GET description");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
   System.out.println(line);
}
input.close();

Output on my computer:

Description
Intel(R) HD Graphics 520

Windows commands are

wmic PATH Win32_videocontroller GET description
wmic PATH Win32_videocontroller GET adapterram
wmic PATH Win32_videocontroller GET driverversion
wmic PATH Win32_videocontroller GET pnpdeviceid

Upvotes: 2

Related Questions