简体   繁体   中英

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:

kCFURLVolumeIsAutomountedKey missing for file://localhost/private/var/setup/: The file “setup” couldn't be opened because there is no such file.

I have checked through my computer and shown hidden files but cannot find the localhost folder.

Here is the output for the version of Java I am running:

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$

I am on a Mac with OSX Sierra, here is the code I am running:

    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 .

Question from link:

I'm running macOS Sierra V10.12, just updated today. 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"}} [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. It may have just been the restart that sorted it, as installing the CLI tools alone didn't solve the problem.

Unfortunately I'm on a Windows machine at work and can't try this with my Mac at home. Hopefully this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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