Skip to content
Advertisement

Is it possible to manipulate the operating system (Windows) with java?

Is it possible to manipulate the operating system with java? I wanted to build a program that manipulates the operating system by creating keys in the windows registry, observes the behavior of the hardware (like a task manager)

Advertisement

Answer

Yes it is possible call native code to perform OS specific calls from Java – such as manipulate the Windows Registry. You should look at JNI – such as this tutorial, or if you use JDK16 or JDK17 you might have a look at the incubating JDK Panama – Foreign Memory API.

However be warned that Panama APIs may change by the time (/whenever) they are incorporated into JDK officially. Also the JDK17 version is different to JDK16, and the tools support that makes Panama so easy to use – jextract – was not released with JDK16 or JDK17 and you may want to view the latest Panama Early Access build instead. This answer has example of native calls using JDK17 Panama.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement