简体   繁体   English

尝试使用Java FX播放MP3文件时,缺少kCFURLVolumeIsAutomountedKey

[英]getting kCFURLVolumeIsAutomountedKey missing when trying to play an MP3 file with Java FX

I am trying to use Java FX to play an MP3 file, but I keep getting the following error: 我正在尝试使用Java FX播放MP3文件,但我不断收到以下错误:

kCFURLVolumeIsAutomountedKey missing for file://localhost/private/var/setup/: The file “setup” couldn't be opened because there is no such file. file:// localhost / private / var / setup /缺少kCFURLVolumeIsAutomountedKey:无法打开文件“setup”,因为没有这样的文件。

I have checked through my computer and shown hidden files but cannot find the localhost folder. 我已通过我的计算机检查并显示隐藏文件,但找不到localhost文件夹。

Here is the output for the version of Java I am running: 以下是我正在运行的Java版本的输出:

java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode) rover-226-42:MP3Player ajgoddu$ java版“1.8.0_112”Java(TM)SE运行时环境(版本1.8.0_112-b16)Java HotSpot(TM)64位服务器VM(版本25.112-b16,混合模式)rover-226-42:MP3Player ajgoddu $

I am on a Mac with OSX Sierra, here is the code I am running: 我在使用OSX Sierra的Mac上,这是我正在运行的代码:

    import java.net.URL;
    import javafx.application.Application;
    import javafx.scene.media.Media;
    import javafx.scene.media.MediaPlayer;
    import javafx.stage.Stage;

    public class MP3 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage primaryStage) {
    Media media = new Media( "file:///Users/ajgoddu/Desktop/Projects/Java/MediaPlayer/MP3Player/test.mp3" );
    MediaPlayer mediaPlayer = new MediaPlayer(media);
    mediaPlayer.play();

    primaryStage.setTitle("Audio Player 1");
    primaryStage.setWidth(200);
    primaryStage.setHeight(200);
    primaryStage.show();
    }
  }

Anybody know what exactly this error means and why it could be happening? 任何人都知道这个错误究竟意味着什么以及它为什么会发生?

Thanks! 谢谢!

Looks like you might need to download the XCode CLI Tools per this slightly unrelated Github issue . 看起来您可能需要根据这个稍微不相关的Github问题下载XCode CLI工具。

Question from link: 链接问题:

I'm running macOS Sierra V10.12, just updated today. 我正在运行macOS Sierra V10.12,今天刚刚更新。 Getting this error message upon running Gulp task: [12:56:04] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' Message: 2016-09-21 12:56:04.205 terminal-notifier[11630:142879] kCFURLVolumeIsAutomountedKey missing for file:///private/var/setup/: Error Domain=NSCocoaErrorDomain Code=260 "The file “setup” couldn't be opened because there is no such file." UserInfo={NSURL=file:///private/var/setup/, NSFilePath=/private/var/setup, NSUnderlyingError=0x7ffe4d632930 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} 运行Gulp任务时收到此错误消息: [12:56:04] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' Message: 2016-09-21 12:56:04.205 terminal-notifier[11630:142879] kCFURLVolumeIsAutomountedKey missing for file:///private/var/setup/: Error Domain=NSCocoaErrorDomain Code=260 "The file “setup” couldn't be opened because there is no such file." UserInfo={NSURL=file:///private/var/setup/, NSFilePath=/private/var/setup, NSUnderlyingError=0x7ffe4d632930 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} [12:56:04] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' Message: 2016-09-21 12:56:04.205 terminal-notifier[11630:142879] kCFURLVolumeIsAutomountedKey missing for file:///private/var/setup/: Error Domain=NSCocoaErrorDomain Code=260 "The file “setup” couldn't be opened because there is no such file." UserInfo={NSURL=file:///private/var/setup/, NSFilePath=/private/var/setup, NSUnderlyingError=0x7ffe4d632930 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Answer: 回答:

I was also having this issue, and after installing the Xcode CLI tools via xcode-select --install and restarting my machine I stopped receiving the error. 我也遇到了这个问题,在通过xcode-select --install安装Xcode CLI工具并重新启动我的机器后,我停止接收错误。 It may have just been the restart that sorted it, as installing the CLI tools alone didn't solve the problem. 它可能只是重新启动对它进行排序,因为单独安装CLI工具并没有解决问题。

Unfortunately I'm on a Windows machine at work and can't try this with my Mac at home. 不幸的是我在工作的Windows机器上,不能在家里用我的Mac试试。 Hopefully this helps. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM