如何在JNLP中播放声音片段?

发布于 2024-08-21 11:50:59 字数 344 浏览 4 评论 0原文

我有以下行来播放声音剪辑:

Applet.newAudioClip(new URL("file:/C:/Dir_Sound/music.au")).play()

它在独立应用程序中工作,但在 jnlp 中我收到错误消息:

java.security.AccessControlException:访问被拒绝(java.io.FilePermission C:/Dir_Sound/music.au read)

我没有在“所有权限模式”下运行它,还有其他方法来播放声音文件吗?

PS:声音文件是程序运行时用户在计算机上选择的,我无法将其嵌入到我的jar中。

I have the following line to play a sound clip :

Applet.newAudioClip(new URL("file:/C:/Dir_Sound/music.au")).play()

it works in standalone app, but in jnlp I got an error message :

java.security.AccessControlException: access denied (java.io.FilePermission C:/Dir_Sound/music.au read)

I'm not running it in "all-permissions mode", is there another way to play the sound file ?

PS : The sound file is selected by the user on his computer when the program runs, I can't embed it in my jar.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

未蓝澄海的烟 2024-08-28 11:50:59

将文件嵌入到您的 Web Start 应用程序中。将带有 jar 的 元素放入 JNLP 文件中。要访问它,请使用 getClassLoader().getResource

Embed the file into your Web Start app. Put a <resources> element with a jar in your JNLP file. To access it, use getClassLoader().getResource.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文