Re: Opening instruments with appletviewer vs. browser



On Jan 26, 8:09 pm, "Andrew Thompson" <andrewtho...@xxxxxxxxx> wrote:
On Jan 27, 5:04 am, "Momo" <m...@xxxxxxxxxxxxxxx> wrote:

A Java program that I've written that makes sounds works fine when I
test it with appletviewer, but not when I use a browser (Firefox or
Explorer). The difference is that when I call the MidiSystem
synthesizer with getAvailableInstruments, I get a bunch of instruments
(411) when running it with appletviewer, but none when using a browser.
Why the difference?

Quite possibly due to bugs in thesoundclasses.
There was a long discussion recently* about how
newer versions of Java showed different behaviour
for the same code.

If that is the case, you might try launching your
applet using web-start, to provide more control
over Java versioning.

* Either here or c.l.j.programmer.

Andrew T.

Thank you for the suggestion. It turned out not to work, but I got to
learn how to use WebStart, so that was good.

The solution to my problem turned out to be that I needed to install
the Java soundbank.

(at http://java.sun.com/products/java-media/sound/soundbanks.html )

Apparently even with the soundbank not installed, Java Sound can (on
Windows) make the sound by using a MIDI port for the sound. It will do
this when launched with appletviewer, but (apparently) not when
launched with a web browser or as an application. It seems that the
web browsers had security issues with letting the applet use a MIDI
port. (I'm still not totally sure why running it as an application
didn't work.)

My apologies for setting the follow-ups incorrectly. I believe that I
did in fact cross-post, rather than multi-posting, however?

Momo

.



Relevant Pages

  • Re: Applet and newbie
    ... 'help' in tyou browser, the latter you can get here. ... loads and displays with AppletViewer and IE 6.0026* _without_ SP2. ... security exceptions. ...
    (comp.lang.java.help)
  • Re: java.lang.SecurityException: Prohibited package name: java
    ... In AppletViewer? ... Prohibited package name: java ... A browser, for example, will *always* ...
    (comp.lang.java.programmer)
  • Re: Opening instruments with appletviewer vs. browser
    ... synthesizer with getAvailableInstruments, I get a bunch of instruments ... when running it with appletviewer, but none when using a browser. ... public class SimpleSound extends JApplet ...
    (comp.lang.java.programmer)
  • Re: java.lang.SecurityException: Prohibited package name: java
    ... I checked in AppletViewer and in a Browser and it worked... ... Andrew Thompson wrote: ... Prohibited package name: java ...
    (comp.lang.java.programmer)
  • Re: setting up classroom lab
    ... > appletviewer is for applets. ... Applets are used in a browser environment, ... > can't, for some odd reason, test their applets in an actual browser. ... already in the cache and retrieve the cached file instead of ...
    (comp.lang.java.help)