How can I play a WAV file using Java? -


I send a WAV file using a client and server, but when I get it, I want to play WAV . I try this method but it does not work:

  runtime.gettime (). Exec ("C: \\ Documents and Settings \\ Administrator \\ Desktop \\ gradpro \\ test1 \\ \\ S1.wav");  

This is the exception I get:

"Error! It does not work! Java.io.IOException: Program can not be run" C: \ Document ": CreateProcess error = 193,% 1 is not a valid Win32 application"

What am I doing wrong?

You need to perform an audio player program (probably Windows Media Player or something) and then file Pass the name (full path of the file) as a parameter:

  string wavPlayer = "/path/to/winmediaplayer.exe"; String fileplatform = "/ path / to / write / file." Runtime.GetRime () Exec (wavPlayer, new string [] {fileToPlay});  

This should work.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -