Question about java.lang.SecurityException

Reply

Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Question about java.lang.SecurityException

 
0
  #1
Jan 4th, 2005
Hello everyone,


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

  1. URL url = null;
  2. try {
  3. url = new URL("file:/c:/temp/sample.wav");
  4. AudioClip clip = Applet.newAudioClip (url);
  5. clip.play();
  6. } catch (MalformedURLException e) {
  7. // TODO Auto-generated catch block
  8. e.printStackTrace();
  9. }

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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Question about java.lang.SecurityException

 
0
  #2
Jan 4th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Question about java.lang.SecurityException

 
0
  #3
Jan 4th, 2005
Thanks jwenting,


Originally Posted by 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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Question about java.lang.SecurityException

 
0
  #4
Jan 10th, 2005
Thanks for all the people who helped me on this thread.


regards,
George
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC