0

Hello everyone,


I have written the following simple program to play a local .wav file.

URL url = null;
try {
	url = new URL("file:/c:/temp/sample.wav");
	AudioClip clip = Applet.newAudioClip (url);
	clip.play();
} catch (MalformedURLException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

But when running the program, the following exception will be thrown,

Exception in thread "main" java.lang.VerifyError: java.lang.SecurityException: java.applet.AudioClip - protected system package 'java.applet'
at java.lang.Class.verify(Class.java:259)
at java.lang.Class.initialize(Class.java:315)

Does anyone know how to solve the issue?


Thanks in advance,
George

2
Contributors
3
Replies
5
Views
12 Years
Discussion Span
Last Post by George2
Featured Replies
  • 1

    Don't use applet classes outside applets, they won't work outside the applet sandbox. If this is an applet, remember you can not access ANY resource that doesn't reside on the same server as the one from which the applet main class was loaded. Read More

1

Don't use applet classes outside applets, they won't work outside the applet sandbox.

If this is an applet, remember you can not access ANY resource that doesn't reside on the same server as the one from which the applet main class was loaded.

0

Thanks jwenting,

Don't use applet classes outside applets, they won't work outside the applet sandbox.

If this is an applet, remember you can not access ANY resource that doesn't reside on the same server as the one from which the applet main class was loaded.

I am not writing an Applet, but a Java application. I simply want to use the ability of playing sound of Applet (Interface AudioClip) in my Java application to save my time of writing sound player. So maybe your approach can not work in my situation.

I am wondering whether it is possible to make my Java application be able to use sound playing ability of class Applet?


regards,
George

0

Thanks for all the people who helped me on this thread.


regards,
George

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.