0

I had some problems with playing sound using JavaFX on my Mac, so I decided to dig a little. I've found class called OSXMediaPlayer, with method that has the following signature:

private native void osxPlay() throws MediaException;

and - unfortunately - an empty body. Does that mean that Java call OSX command under the hood? Can I open a terminal and try it myself?

Kamil Latosinski
  • 756
  • 5
  • 28
  • 2
    `native` means the method is not written in Java - the code will probably be written in C using macOS audio APIs. – greg-449 May 01 '19 at 13:56
  • Possible duplicate of [What is the native keyword in Java for?](https://stackoverflow.com/questions/6101311/what-is-the-native-keyword-in-java-for) – user1803551 May 01 '19 at 20:50

1 Answers1

1

Does that mean that Java call OSX command under the hood?

It does not call a command line program. It calls the native macOS audio APIs CoreAudio or AVFoundation.

Can I open a terminal and try it myself?

No, because the terminal only lets you access command line programs, not APIs.

Hendrik
  • 5,085
  • 24
  • 56