3
When trying to compile the code below:
import javax.swing.*;
import sun.audio.*;
import com.sun.java.util.*;
import java.awt.*;
import java.awt.Event.*;
import java.io.*;
public class filechus {
public static void main(String[]args) {
JFrame tela = new JFrame("Telex");
JFileChooser filex = new JFileChooser();
int opcao = filex.showOpenDialog(tela);
if (opcao==JFileChooser.APPROVE_OPTION) {
File nomearquivo = filex.getSelectedFile();
try {
InputStream arq = new FileInputStream(nomearquivo);
AudioStream som = new AudioStream(arq);
AudioPlayer.player.start(som);
System.out.println("Tocando");
}
catch(Exception e) {
System.out.println("Deu erro");
}
}
tela.setBounds(10,10,800,600);
tela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tela.setVisible(true);
}
}
I get the following error message:
Audioplayer is Internal Proprietary api and may be Removed in a Future release
How can I fix this?
What’s the mistake you’re making? Could you elaborate more on the question?
– João Neto
Greetings, it turns out that when I compile, the same gives the following error: audio player is Internal Proprietary api and may be Removed in a Future release
– Augusto Tomás
Is that a mistake or is it just a warning (Warning)? The program finishes compiling and runs?
– mgibsonbr
This is a (Warning), but the program did not end of complicating, until they gave me the solution below, by @Victor.
– Augusto Tomás