Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden. Du solltest ein Upgrade durchführen oder ein alternativer Browser verwenden.
folgender Code funktioniert bei mir nur lokal, also im Applet Viewer von Eclipse. Wenn ich alles zusammen auf meinen Webspace hochlade, bleibt das Applet einfach stumm, funktioniert aber ansonsten einwandfrei:
Code:
public class StarfieldApplet extends JApplet
{
public void init()
{
add(new Panel());
try
{
// should work always, as long as the sound file is in the same directory as this class
AudioClip sound = this.getAudioClip(getCodeBase(),
"bb_last_honour.wav");
sound.play();
} catch (Exception e)
{
System.out.println("### Error: could not load bb_last_honour.wav");
e.printStackTrace();
}
}
}
Woran kann das liegen? Die Sound Datei ist zwar zugegebener Maßen recht groß (1.5 MB) trotzdem hört man auch nach längerem warten nichts.
Ich hatte mir nicht die Mühe gemacht, auch mal dein Applet auszuführen.
Die Ausgabe meiner Java-Console:
L-ectron-X' Opera-Java-Console hat gesagt.:
### Error: could not load bb_last_honour.wav
java.security.AccessControlException: access denied (java.net.SocketPermission 404.funpic.de resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at com.opera.OperaURLConnection.waitForHeaderLoaded(OperaURLConnection.java:299)
at com.opera.OperaURLConnection.connect(OperaURLConnection.java:94)
at com.opera.OperaURLConnection.getInputStream(OperaURLConnection.java:116)
at java.net.URL.openStream(Unknown Source)
at sun.applet.AppletAudioClip.<init>(Unknown Source)
at java.applet.Applet.newAudioClip(Unknown Source)
at StarfieldApplet.init(StarfieldApplet.java:20)
at com.opera.AppletPanel.runHandlerThread(AppletPanel.java:445)
at com.opera.AppletPanel.run(AppletPanel.java:341)
at java.lang.Thread.run(Unknown Source)
"This exception is thrown by the AccessController to indicate that a requested access (to a critical system resource such as the file system or the network) is denied.
The reason to deny access can vary. For example, the requested permission might be of an incorrect type, contain an invalid value, or request access that is not allowed according to the security policy. Such information should be given whenever possible at the time the exception is thrown. "
Nur hilft mir das auch nicht weiter. Die Datei existiert definitiv und ich hab ihr auch Lese-Rechte gegeben.. kA was das sein soll... inzwischen bin ich schon bei der Vermutung angelangt, dass der Zugriff irgendwie durch meinen Anbieter (funpic) blockiert wird... aber das is ja sehr unwahrscheinlich.. warum sollten die das tun, und ist das überhaupt möglich