🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.javascript
2 messages
2 total messages Started by Alex Pavlov Wed, 30 Aug 2000 00:00
Problem with applet/javascript on Mac platform
#89
Author: Alex Pavlov
Date: Wed, 30 Aug 2000 00:00
73 lines
3021 bytes
Greetings....
I try to call java applet from javascript. On Win32 all work fine, but I
have troubles on Mac platform.
Troble with IE on Mac:
    I recieve error message 'object has no properties' in line of
javascript, where I call method of applet.
Trouble with NN on Mac:
    I receive exception while loading applet:
Netscape Communications Corporation -- Java 1.1.5
Type '?' for options.
Symantec Java! ByteCode Compiler Copyright (C) 1996-97 Symantec
Corporation
# Applet exception: class testapplet not found
java.lang.ClassNotFoundException: java/awt/event/ActionListener
  at java.lang.ClassLoader.defineClass(Compiled Code)
  at netscape.applet.AppletClassLoader.findClass(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
* at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
  at netscape.applet.DerivedAppletFrame.run(Compiled Code)
  at java.lang.Thread.run(Compiled Code)

 I get reference to loaded applet via such lines in Javascript and this
code work fine:

          var appletRef = document.applets[0];
or
          var appletRef = document.applets['appletName'];
or
          var appletRef = document.apletName;


then call your applet in javascript using:
            appletRef.appletMethod('paramToApplet');
I receive error message on this line in IE.

I use this applet for example:

import java.awt.*;
import java.applet.Applet;

public class testapplet extends Applet {
  public String myString;
  TextField myField;

  public void init() {
    setLayout(new BorderLayout());
    myField = new TextField();
    myField.setEditable(false);
    add("Center", myField);
    setString("Initial string");
  }

  public void setString(String s) {
    myField.setText(s);
  }
}

example of HTML:
...
<APPLET CODE=testapplet.class WIDTH=150 HEIGHT=25>
</APPLET>
<FORM>
<INPUT TYPE="text" NAME=mytext SIZE=50>
<INPUT TYPE="button" VALUE="evaluate"
onClick="document.applets[0].setString(eval(this.form.mytext.value))">
</FORM>
...

    Any suggestion?
    Sincerely, Alex Pavlov.
eVelopers, Inc
apavlov @ evelopers.com
Re: Problem with applet/javascript on Mac platform
#90
Author: GalaSoft Laurent Bugnion
Date: Wed, 30 Aug 2000 00:00
29 lines
1959 bytes
Hi Alex,

Alex Pavlov wrote:
> 
> Greetings....
> I try to call java applet from javascript. On Win32 all work fine, but I
> have troubles on Mac platform.
> Troble with IE on Mac:
>     I recieve error message 'object has no properties' in line of
> javascript, where I call method of applet.
> Trouble with NN on Mac:
>     I receive exception while loading applet:
<code snipped>

Seems to me that the error doesn't come from your script, but already
when the browser attempts to load the applet. With what JDK is your
applet made? The class ActionEvent in the package java.awt.event doesn't
exist in JDK 1.0.2, and I suspect that it doesn't as well in JDK 1.1.5
(but it should be confirmed). Anyway, the browser has trouble finding
this class and thus cannot start the applet. Which means that you'll
have more success if you ask this question to a Java related newsgroup,
like comp.lang.java.programmer.

Laurent
-- 
GalaSoft Laurent Bugnion
Phone/Fax: +41 (1) 9268510
Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
Support the childrens of Calcutta: http://www.calcutta-espoir.ch
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads