• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about java.lang.SecurityException

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,


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



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
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know the problem is that you are running an applet .. the only way I know around this is to sign the applet to allow access to the underlying file structure!
You can check that on the sun's website.
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't use applets but what if you changed the URL for the WAV to be an http URL? I think the restriction in applets is related to local file access.
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Barry,


Originally posted by Barry Higgins:
As far as I know the problem is that you are running an applet .. the only way I know around this is to sign the applet to allow access to the underlying file structure!
You can check that on the sun's website.



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 how to make my Java application be able to use sound playing ability of class Applet?


regards,
George
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Greg,


Originally posted by Greg T Robertson:
I don't use applets but what if you changed the URL for the WAV to be an http URL? I think the restriction in applets is related to local file access.



Your reply is very helpful. I am wondering how to changed the URL for the WAV to be an http URL so that I can restrict the access to local file system. Can you show me some sample source codes?


regards,
George
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to this, there is a simple way to play audio files in an application without using the methods from Applet.

HTH

Layne
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Layne,


Originally posted by Layne Lund:
According to this, there is a simple way to play audio files in an application without using the methods from Applet.

HTH

Layne



The article is very helpful. I have tried the sample application provided in this article on my platform, but it does not work (JVM has no output and no sound is heard). I am wondering what is the trouble? Do you know some other approaches to play sound?


regards,
George
reply
    Bookmark Topic Watch Topic
  • New Topic