Answer the question
In order to leave comments, you need to log in
Javafx.scene.media.AudioClip; How to play a file whose name contains spaces???
In general, in the process of studying java and javaFX API in particular, I decided to write a simple audio player. In the process, I encountered the fact that the AudioClip class, which I planned to use to play files, does not want to play files whose name contains a space.
Question: Is there any way to fix this?
PS Files without spaces in the name are played perfectly.
PPS I don't see any reason to apply the entire source code, the main exciting piece is:
AudioClip player = new AudioClip(filepath);
player.play();
Answer the question
In order to leave comments, you need to log in
Try to go through File
:
File file = new File("Путь к файлу с пробелами");
String path = file.toURI().toASCIIString();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question