You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
javac SoundRecorder.java && java SoundRecorder, from Terminal, it works. Reset with: sudo tccutil reset Microphone com.apple.Terminal
IntelliJ
✅ PASS
From the Project Explorer, Right Click SoundRecorder.java, Run. It works. Reset with: sudo tccutil reset Microphone com.jetbrains.intellij.ce
Bundle
🚫 FAIL
./package.sh, double-click SoundRecorer.app. It doesn't work.
Passing criteria:
MacOS should prompt for permission to access the microphone, the resulting .wav file should contain audio, not silence.
Some initial observations:
Failing tests produce a silent .wav file for the specified duration. No prompt; no Java exceptions thrown.
Successful test show the parent app, not Java. e.g. "IntellIJ would like to access the Microphone".
You only get one chance to Approve. Dismissing the dialog will assume "No" and the option will need to be manually added using System Preferences, Security & Privacy, Privacy, Microphone.
Unlike other macOS privacy settings, there's currently no way to manually add an App to the Microphone area.
Java version tested:
AdoptOpenJDK 11.0.10
API: AudioSystem.getLine(...).open(...)
Some general questions:
Are entitlements required for Microphone access to work?
Can entitlements be applied to a non-binary (e.g shell script) executables?
We discovered that in addition to ensuring NSMicrophoneUsageDescription
was in the plist in the mac app bundle package Contents when built, these entitlements also needed to be set:
We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable.
It will be closed soon unless the stale label is removed by a committer, or a new comment is made.
Question
Why won't Java ask for Microphone access? How does one package a Java application so that will properly ask for permission to use the microphone?
Please see the following unit test: https://github.com/tresf/SoundRecorder.
javac SoundRecorder.java && java SoundRecorder
, from Terminal, it works.Reset with:
sudo tccutil reset Microphone com.apple.Terminal
SoundRecorder.java
, Run. It works.Reset with:
sudo tccutil reset Microphone com.jetbrains.intellij.ce
./package.sh
, double-clickSoundRecorer.app
. It doesn't work.Passing criteria:
.wav
file should contain audio, not silence.Some initial observations:
.wav
file for the specified duration. No prompt; no Java exceptions thrown.Java version tested:
AudioSystem.getLine(...).open(...)
Some general questions:
Related questions:
"VSCode terminal doesn't allow/request permissions to access media devices"
"Application doesn't ask for permission to access microphone in MacOS 10.14 Mojave"
"How to give Microphone permission to Java application (macOS Mojave and above)?"
"OpenCV command line app can't access camera under macOS Mojave"
"Cannot Access Microphone on Mac Mojave using pyaudio"
"How to record microphone on macos with pyaudio?"
Note: Big Sur can have caching issues between signing steps.
The text was updated successfully, but these errors were encountered: