Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use sun.audio with java 9

Tags:

java-9

sun

i am working on adapting my desktop app to run with jre9 i get

java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: sun/audio/AudioStream

i had some other problems with sun API that i resolved by adding the jvm args --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.desktop/sun.swing=ALL-UNNAMED but in those cases the error was of type java.lang.IllegalAccessError so exporting the model solved the problem.

any idea how can keep using the sun.audio? of course i can try to switch to a different library like javax.sound but i have some legacy code that i rather not touch.

i tried some options like --add-open and --illegal-access but assuming the sun.audio api was removed form the sdk those options won't make any difference

like image 604
Efi G Avatar asked Jul 26 '26 03:07

Efi G


1 Answers

As Alan Bateman commented, sun.audio packages were removed from jdk9.

I ended up replacing the usage of the sun.audio package in my code.

like image 82
Efi G Avatar answered Jul 28 '26 16:07

Efi G



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!