Вопрос

I am beginning to write a basic "study-buddy" program as a side project. One important feature I want to implement is that the program can access the state of other programs running to prevent you from accessing them / yell at you. For instance, if you had Chrome open to Facebook, or if you launched a video game. First off, is this even possible/reasonable to accomplish in Java? Second, specifically with Chrome, how can I access the programs state from another program that I am writing? More generally, how can I access ALL programs running on the computer and check to see whether anything violates "study-permissible" programs?

Это было полезно?

Решение

I would put this as a comment, but my reputation point is not enough. One way is using the commands the operating system provides. You can run a command with

Runtime.getRuntime().exec("<command name>");

This will give you the related process and you can get the output of that process just as manually running the process. Then, you can utilize the output. Basically if the OS provides you that information manually, you should be able to get the information within Java.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top