Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How does Java Sound know about plug-ins (a.k.a. “service providers”)?

0
Posted

How does Java Sound know about plug-ins (a.k.a. “service providers”)?

0

If installed correctly, plug-ins are recognized automatically by the runtime initialisation system of Java Sound. It scans the classpath for configuration files like /META-INF/services/javax.sound.midi.spi.MidiDeviceProvider. Since the method ClassLoader.getResources() is used for this, multiple locations can be returned. To make it work the desired way, the service providers are packaged into a .jar together with such a configuration file. The configuration file just contains fully qualified class names. See also Appendix 1: Code Overview: AudioSystem.java By the way, this mechanism is not Java Sound specific: it’s also used for I/O encoding handling, image I/O and several other locations.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123