title: JavaFx AudioClip : URL don't work when the audio file is placed inside src folder of the project?
body: <p><strong>My Code</strong></p>
  
  <pre><code>package main;
  import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.Label;
  import javafx.scene.image.Image;
  import javafx.scene.image.ImageView;
  import javafx.scene.layout.VBox;
  import javafx.scene.media.AudioClip;
  import javafx.scene.text.Font;
  import javafx.stage.Stage;
  
  
  public class Main extends Application {
      public void start(Stage primaryStage) throws Exception {
          Font font = Font.loadFont( Main.class.getClassLoader().getResourceAsStream("resources/TRON.TTF"), 10);
  
          //ImageView image = new ImageView(new Image("file:outside/bell.png"));
  
         ImageView image = new ImageView(new Image("resources/images/redseven.png"));
  
         //This works when file is outside src folder
          //AudioClip audio = new AudioClip("file:sounds/win.wav");
  
          //doesn't work
         //AudioClip audio = new AudioClip("file:resources/sounds/win.wav");
  
          //doesn't work
          AudioClip audio = new AudioClip("resources/sounds/win.wav");
  
          audio.play();
  
  
  
          VBox pane = new VBox();
          Label label = new Label("Text");
          label.setStyle("-fx-font-family:'Tron'; -fx-font-size: 50px;-fx-text-fill: red");
  
          pane.getChildren().addAll(label, image);
  
          Scene scene = new Scene(pane, 500, 500);
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p><strong>My Project directory</strong></p>
  
  <p><a href="https://i.stack.imgur.com/JEKMp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JEKMp.png" alt="enter image description here"></a></p>
  
  <p><strong>Output</strong></p>
  
  <blockquote>
    <p>Caused by: java.lang.IllegalArgumentException: uri.getScheme() ==
    null! uri == 'resources/sounds/win.wav'</p>
  </blockquote>
  
  <p>The image url's work when they are outside src folder and inside src folder. When they are outside I have to include "file:" before the url as shown in the code.</p>
  
  <p>Audioclip irls work when they are file is outside src. But doesn't work when it's inside.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Doing this works. But I'm not really sure why?</p>
  
  <pre><code>AudioClip audio = new AudioClip("file:src/resources/sounds/win.wav");
  </code></pre>
  
  <p>I added the src folder also to the url and then added "file:" infront of it.
  Why doesn't it work  with relative path? The image is loaded without any problem.</p>