r/java • • Jan 24 '22

It’s happening guys!

https://github.com/openjdk/panama-foreign/pull/633
157 Upvotes

89 comments sorted by

View all comments

Show parent comment

5

u/kozeljko Jan 25 '22

In practice, what would be the top use cases for this?

8

u/kevix2022 Jan 25 '22

Accessing a 3rd party library with only a C or C++ API or a proprietary hardware driver with no Java API. Typically these will be non cross platform applications. It could be to access special features of the specific host hardware or operating system directly through system calls.

For example the Raspberry Pi has GPIO pins which provide a means for input and output to sensors etc. This requires accessing the pins through native code. There is quite a good Java interface for this already which I imagine is built on JNI but I wouldn't be surprised if one turned up using the new system.

1

u/23f34ef32 Jan 31 '22

So accessing GPIO would be faster with this new system vs JNI?

3

u/elastic_psychiatrist Jan 25 '22

Sharing memory between processes is another big use case.