JavaScript - Applet in 1.5

Did something change in version 1.5 to talk between an applet and a javascript function?
In previous versions, you did:
import netscape.javascript.*;
Great.
Doing a search for the JAWS.jar on my hard drive comes up with it in two places:
1) The SDK for 1.4.02
2) The JRE for 1.4.02
Nothing in either the SDK for 1.5 or the JRE of 1.5.
So, you say, simply copy the stupid file over, right? I'm afraid the standard install of the JRE of 1.5 won't contain it, and it won't run for the user.
Is there a new way of communicating in 1.5 now?
Thanks -

In fact, plugin.jar (jdk1.4.2 and 5.0) or jaws.jar (jdk 1.3) are simply collections of .class files.
If you check the classpath of the Sun Plugin (use the Sun Java Console, press "s" and check the option javaplugin.vm.options. In my machine it says:
javaplugin.vm.options = -Djava.class.path=C:\PROGRA~1\Java\JRE15~1.0\classes -Xbootclasspath/a:C:\PROGRA~1\Java\JRE15~1.0\lib\deploy.jar;C:\PROGRA~1\Java\JRE15~1.0\lib\plugin.jar -Xmx96m -Djavaplugin.maxHeapSize=96m -Xverify:remote -Djavaplugin.version=1.5.0 -Djavaplugin.nodotversion=150 -Dbrowser=sun.plugin -DtrustProxy=true -Dapplication.home=C:\PROGRA~1\Java\JRE15~1.0 -Djava.protocol.handler.pkgs=sun.plugin.net.protocol
So the "plugin.jar" (or jaws.jar in JDK 1.3) is automatically added to the classpath.
If the netscape.javascript.JSObject class was not changed between the JDK 1.3 and 5.0 versions, you can compile programs using it using JDK 1.3 and run them in JRE 5.0 without bothering about such a problem.

Similar Messages

  • How would/should you invoke a javascriptable applet from WDA or WDJ?

    The background to this question is here:
    OK - finally a bioinformatic coding problem that may not be so easy ...
    The question is as follows.
    Suppose you have a javascriptable applet - that is, an applet whose behavior can be tailored by passing it certain parameters from javascript.
    What would the best way be to invoke the javascript from WDA or WDJ, assuming that you wanted to "pop" the applet in a separate HTML frame within tne WDA or WDJ application?

    Anton -
    Glad to see you contributing again!
    Well, your original comment about RasMol shamed me into doing some research into molecular viewers callable as applets.
    Here are the latest responses I've gotten from Angel Herraez at Jmol.  (You might find it fun to join the Jmol project at SourceForge and also subscribe to its jmol-users list-server.)
    I told Angel that here's what I want to do:
    > 1) we're in Frame1 of a portal that has two other frames in it: FrameA and
    > FrameB.
    >
    > 2) A query in Frame1 against a certain database brings back two sets of
    > specifications for Jmol, say:
    >
    > a 1hru, A, 123-145
    > b) 2eqa, A, 144-167
    >
    > 3) Via "client-side eventing" at the portal level , the portal passes the
    > parameters in (a) to JMol and Jmol runs in FrameA to display the "partial"
    > structure view requested (with rotate capability, same as in interactive
    > JMol;
    >
    > 4) At the same time , the portal passes the parameters in (b) to JMol and
    > Jmol runs in FrameB to display the "partial" structure view requested (with
    > rotate capability, same as in interactive JMol;
    >
    > Is this scenario currently possible as JMol is currently written?
    He then responded:
    As long as you have already set the means to communicate with the
    Jmol applets in your portal system, I think it is indeed.
    This is what I'd pass to Jmol in FrameA:
    load "1hru.pdb"; display *:A and 123-145;
    and this to jmol in FrameB:
    load "2eqa.pdb"; display *:A and 144-167;
    (you will have to adjust the loading of the pdb file depending on
    where it is located)
    "display" is a better choice than the alternative, "restrict", for
    reason I won't discuss now (but we can separately, if you need it)
    Depending on your ways of inserting Jmol into your frames, there may
    be some details to solve, but on the Jmol scripting side that's all
    needed.
    > Or would I have to settle for the portal simply invoking Jmol in FrameB
    > and again in FrameC and letting the user manipulate settings in the
    > console, as you suggest.
    No, I won't suggest so, you can indeed preprogram what you want.
    I also asked him about capturing the views after rotating in each frame to get the desired view of each structure, and here's his response to that:
    Yes, the views can be captured to the user's computer, in a web page
    (e.g. popup window) from where the user can copy or save them to
    disk, using the browser's capabilities.
    If you need to "capture" to the server, I cannot say *but see below.
    The discussion on how to make snapshots is quite long. There are
    several mesages in the list some time ago and there are several
    places that use this functionality; Bob has at least one, I dont0
    remember exactly where right now, and I have a testpage/tutorial at
    http://biomodel.uah.es/Jmol/export-image/index.htm
    See if you can make it from that, then ask if you need help.
    >From the screenshot, displayed inside the browser, you can save
    directly to your disk in some browsers, or else copy-paste into any
    image editing program (I would not recommend Powerpoint, as the
    quality of saved images is poor). You get a jpeg file directly.
    Now that I think of it, in fact all the trouble was getting the
    server-generated image into the client browser, so there should be a
    way to store the image in the server maybe.
    Anyway, will you be in LasVegas?
    If so, will you be at SDN Community Day?
    If neither, do you have MS shareview ????
    Anyway, I will be talking soon (this weekend) in the WIKI about "alignments" and how I have to use them to get the results at StrucClues (http://strucclue.ornl.gov).
    This is where the really interesting and heavy regex-ing and returned html parsing is going to come in, so I hope you will remain interested long enough to solve the new propblems I am going to pose.  They will be much more related to real scripting problems - I just wanted to get this "view/rotate" issue out of the way, so that I could do an honest job at my SDN Community Day Session.
    Very best regards
    djh

  • HTML, JavaScript, Applets possible in Web-Dynpro Applications?

    Hello Community,
    I'm developing a JEE5-Application using Web-Dynpro for the User-Interface. Web-Dynpro works fine for the most functions and processes of the application. But there are some special requirements i don't know to implement them using Web-Dynpro.
    So my question is, if there is the possibility for:
    using HTML-Code in a Web-Dynpro UI-App  (the HTML dynamically generated by Web-Dynpro)
    using JavaScript in the Web-Dynpro UI-App
    using Java-Applets (for example to interact if local computer resources)
    using an HTML-Editor for editing Texts in the Application (for example freeware Edtior fckeditor)
    or do i have to use JSF in that case?
    regards
    Matthias

    Hi Matthias,
    I will answer your question point wise, in short:
    1) Using HTML-Code in a Web-Dynpro UI-App (the HTML dynamically generated by Web-Dynpro)
    Ans: it is possible to put the HTML code in the WebDynpro UI App. Use the IFrame Ui element to do the same. See this:
    http://help.sap.com/saphelp_nw04/helpdata/EN/e9/7652a84fada444bd11ca73670ce7dc/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/15/c07941601b1d09e10000000a155106/frameset.htm
    Displaying HTML in WebDynpro View
    2) Using JavaScript in the Web-Dynpro UI-App
    Ans: Not Possible.
    3) Using Java-Applets (for example to interact if local computer resources)
    Ans: Not Possible.
    4) Using an HTML-Editor for editing Texts in the Application (for example freeware Edtior fckeditor)
    Ans: Not possible.
    I hope this helps!
    Regards,
    Pravesh

  • JavaScript -Applet Communication problem

    Hi All,
    Requirement : Onclick of particular location of loaded applet. I am calling JavaScript function which will render the table(as a popup like a bubble).
    Problem Description:
    I am calling below javascript function from Applet. Javascript function contains the code which create a table (popup). We have verified the JS function and it is displaying in normal HTML.
    JavaScript Function
    function CreateBubble(txt)
    var t= GetElement('TABLE');
    //t.style.background = 'white';
    t.cellSpacing=0;
    t.cellPadding=0;
    var r,c;
    r=t.insertRow();
    c=r.insertCell();
    c.innerHTML='<img src="images/nw.gif">';
    c=r.insertCell();
    c.innerHTML='<img src="images/n.gif">';
    c.style.background = 'url("images/n.gif")';
    c=r.insertCell();
    c.innerHTML='<img src="images/ne.gif">';
    r=t.insertRow();
    c=r.insertCell();
    c.innerHTML='<img src="images/w.gif">';
    c.style.background = 'url("images/w.gif")';
    c=r.insertCell();
    c.style.background = 'url("images/1.gif")';
    c.style.backgroundColor='white';
    if(txt.tagName)
    c.appendChild(txt);
    else
    c.innerHTML=txt;
    c=r.insertCell();
    c.innerHTML='<img src="images/e.gif">';
    c.style.background = 'url("images/e.gif")';
    r=t.insertRow();
    c=r.insertCell();
    c.innerHTML='<img src="images/sw.gif">';
    c=r.insertCell();
    c.innerHTML='<img src="images/s.gif">';
    c.style.background = 'url("images/s.gif")';
    c=r.insertCell();
    c.innerHTML='<img src="images/se.gif">';
    return t;
    function GetElement(t){return document.createElement(t);}
    When I call CreateBubble(txt) function from Applet. It is not rendering table. If i put the alert inside the function then it displays. I tried to debug by puttting alert before return statement of the JS function. It still display the alert box, but doesn't display the table.
    I am not sure but the applet might be overshadow the table created through java-script.
    This is my applet code:
    public void mouseClicked(MouseEvent e)
              System.out.println( "Mouse clicked in applet - Getting JSObject" );
              System.out.println(("X, Y :" + e.getX() + "," +e.getY()));
              //First segement point
              if(e.getX() > 200 && e.getX() < 212){
                   JSObject jso = JSObject.getWindow( enclosingContainer );
                   System.out.println( "Getting JSObject - SUCCESS" );
                   System.out.println( "Invoking the script..." );
                   String [] args = new String[] {"acdd"};
                   jso.call("CreateBubble", args);
    Let me know are there any other approach to do so?
    Thanks
    Chintan

    Only pass strings between applets and JS. They both use unicode, so it works. Other data types, including primitive, don't work well.
    In your JS code, you say, txt.tagName. This doesn't make sense if txt is a string.
    Also, your Java code to call the JS looks funny. See the Java code in reply #11 in this thread: http://forum.java.sun.com/thread.jspa?forumID=421&threadID=482551

  • Javascript-Applet connection: Help!

    Hi,
    Below is a JSP page followed by the Applet that it loads. The applet displays an inputDialog in the init() method and another int he setNum(...) method. Init() displays the dialog correctly, but setNum hangs IE completely when it displays de dialog. Where did I go wrong?
    Thanks for your help.
    Miguel
    PS Type a number in the text box and push the "Do" button.<HTML>
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function send() {
    alert("send");
    var num = parseInt(document.forms[0].Num.value);
    document.applets[0].SetNum(num);
    alert("send: num..." + num);
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM>
    <BR>Num: <INPUT TYPE=TEXT NAME=Num>
    <BR><INPUT TYPE=BUTTON NAME="Do" VALUE="Do" onClick="send()">
    </FORM>
    <APPLET CODE="test.class" WIDTH = 500 HEIGHT = 250 MYSCRIPT>
    </APPLET>
    </BODY>
    </HTML>
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class test extends JApplet {
    public void init() {
    String str = JOptionPane.showInputDialog("init....");
    public void SetNum(int num) {
    String str2 = JOptionPane.showInputDialog("SetNum: " + num);

    zneroladivad,
    Thanks for your reply. My Tomcat console window does not show any output other than the messages during startup. I searched all of my computer but I could not find a file called plugin.trace.
    Just in case, the inputDialog actually shows the information I expected. The only trouble is that I can't dismiss it, I can't type data in it and, I can't select any IE options other than close the main window with the X at the top right corner.
    I hope this helps,
    Miguel

  • Javascript to decide to load or not to load an applet

    Hi experts,
    I have the html containing two applets. I want that the second applet will be loaded or not depending on the result of the first one. How can I use javascript to check that? Now the bad result of the first applet is to redirect to other page but the second applet is always loaded.
    <html>
    <javascript>
    if <result from applet 1> {load applet 2}
    else <bad result> {redirect page}
    </javascript>
    <applet 1>
    <applet 2>
    </html>
    Thanks

    Jared, you got a lot of response to this one in another forum, but to get the ball rolling here, I'll start with my proverbial $0.02.In general I prefer the level 0 approach. This tends to mean, however, that it's tricky to do other than hardcode the allocation for each allocation'family'. At least if you enter it into the parent, it's fairly easy to write one generic calc expression using @parentval since this will always hold the amt to be allocated.

  • Help!!!! JEditorPane and javascript

    i am using JEditorPane in my project to display web pages. But JEditorPane does not support javascript, Applet, Shockwave animations.
    Is there any way to Support all these things in JEditorPane by extra coding or Using open source code like Mozila's
    Rhino ( javascript interpreter ).
    Thanks in advance

    i am using JEditorPane in my project to display web
    pages. But JEditorPane does not support javascript,
    Applet, Shockwave animations.
    Is there any way to Support all these things in
    JEditorPane by extra coding Sure, but it won't be a trivial task, just like creating your own web browser.
    or Using open source code like Mozila's
    Rhino ( javascript interpreter ).
    Thanks in advanceJava 1.6 has Mozila's JavaScript engine built-in:
    http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
    You may also want to read these:
    http://forum.java.sun.com/thread.jspa?threadID=593120&messageID=3108523
    http://www.jguru.com/faq/view.jsp?EID=25662

  • If WDA will be able to call a Flash island, and Flash can call javascript

    In this thread here:
    How would/should you invoke a javascriptable applet from WDA or WDJ?
    Thomas said that an upcoming release of WDA will let WDA call Flash "islands".
    Since this link:
    http://www.adobe.com/devnet/flash/articles/external_interface.html
    says that Flash can invoke javascript,  won't it be possible for WDA to call an applet indirectly by calling Flash and letting Flash call the applet ?
    djh

    Anton -
    I asked Thomas Stout to describe exactly what he's doing with Flex and JMol, and I'm posting his response just to be sure that there is no way (other than the portal) of duplicating what he is doing using WDA.
    Here's his response:
    Backend (linux):
    - we have a "database" of crystal structures in flat-file directories (for example,
    weekly rsync's from the PDB)
    - we parse those with perl scripts into an XML table with tagged data that we
    feel is relevant
    Flex:
    - the Flex app is constructed to load that XML file and display the data in a
    table.  We exported that code from Flex into an HTML table, which provided
    the basic page with a Flash movie of the Flex app embedded (See the attached
    screenshot from a development version of our web page: it's the horizontal
    rectangle at the top of the page).
    webpage:
    - we then built of the Jmol functionality into the lower half of this web page.  The
    table entries at the top are sortable on any column and filterable via the text
    box.  Once a line in the table is selected, the "Load" button passes the
    accompanying structure to the Jmol applet and all of the Jmol "tools" become
    active in the lower half of the page.   There is no communication in the reverse
    direction (can't think of why you would want to!).
    - BTW, the web page does not use "frames" -- I'm personally opposed to them --
    but it is all constructed within a table.  The Flash movie is in a table cell that
    spans two columns, the Jmol app is down a row and in the left hand (wider) cell,
    while the selectable links on the right are all in the right-hand cell.  The page is
    an amusing gmisch of HTML, javascript and JmolScript all fighting it out
    together.....    :)

  • Why is Safari on Windows XP treating Java Applets differently?

    Safari on Windows (and Mac) seems to load Java Applets differently. I review of the list of installed plugins shows both the Apple Java plugin and the installed java j2se 1.6_25 applet plugin to be handling the mime type for java applets. Does this mean java applets are loaded/deployed by the Apple plugin instead of the Oracle java plugin? Is there are work around such that I can make the applets behave the same on Safari as on, say, Mozilla.
    Examples of different behavior:
    1) ClassNotFound exception even though all jars and classes are in the classpath (loads fine on Mozilla)
    2) Malformed URL exception when running applets from Oracle tutorial pages.
    3) Javascript<->Applet communication does not work.
    Thanks
    Al

    Never got resolved, so we don't use Safari for Windows even still in 2009 b/c this site crashes Safari. But the site works on Mac Safari or Windows IE.

  • Using a JavaScript function as a listener

    Problem with the original Java plug-in system. Most all my customers are forced to use the original Java plug-in (not the Next-Gen). So, I need a solution that works for the original please.
    JavaScript:
    applet.addActionListener({
        actionPerformed: function(evt) {
            alert("Heard the event!\n" + evt.toString());
    Java Applet (snippet):
    private JButton pushButton;
    public void addActionListener(final JSObject jsl) {
        // Wrap the JSObject in an ActionListener.
        ActionListener l = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jsl.call("actionPerformed", new Object[] { evt });
        // Add the JS listener to the button so it gets informed of clicks.
        pushButton.addActionListener(l);
    }This works fine if I could use the Next-Gen plug-in, but as I mentioned earlier, I am prohibited from using that.
    Oddly enough, this code seems to work in IE, but it fails in Firefox. In Firefox while the JSObject itself is not equal to null, calling "toString()" on it returns "null". Thus, the call to "call(...)" does nothing and the JS function is never called.
    In IE, it may be necessary to use a full-fledged class to store the reference to the JSObject. The "final" keyword should preserve it, but sometimes it doesn't.
    public class JSActionListener implements ActionListener {
        private final JSObject jsObj;
        public JSActionListener(JSObject jsObj) {
            this.jsObj = jsObj;
        public void actionPerformed(ActionEvent evt) {
            jsObj.call("actionPerformed", new Object[] { evt });
    public void addActionListener(final JSObject jsl) {
        // Wrap the JSObject in an ActionListener.
        ActionListener l = new JSActionListener(jsl);
        // Add the JS listener to the button so it gets informed of clicks.
        pushButton.addActionListener(l);
    }

    I'm such a moron. I never put in a trace command to see if
    the last line of my shrink command was getting executed. It turns
    out the movie doesn't scale perfectly to 16.5 but instead goes to
    16.49etcetc. As a result that last line wasn't being executed. Now
    everything works. But I was wondering if you guys could think of a
    nice way to compartmentalize all of this code, like maybe store it
    all in a variable or something, so I can attach it to several
    different movie clips?

  • How to update a textarea from an applet on Mac OS

    Hi, i'm writing an applet and I would like to update a textarea, of the same html page, from my applet.
    I'm working on MAC OS (LiveConnect doesn't work).
    I've tried the solution that i've found at this address: http://www.rgagnon.com/ce/java-js.html, but the data are transmitted via the url (by means of the GET method) and i've too much data to move.
    I would appreciate any help.

    Your applet can open an URLConnection and read directly a document from your webserver.
    public String readText() {
      java.net.HttpURLConnection conn = (java.net.HttpURLConnection)myURL.openConnection(); ...
    }So using JavaScript on your page, you might call readText() to fill that textarea.
    The interesting link you gave, handled the JavaScript/Applet interaction. Test that with just return "Hello";.
    The real programming is more interesting.

  • Can not show applet in jeditorpane

    Hi,
    I want to load a Web page which contains an applet into a JeditorPane, but I found the applet can not show in the editorpane.
    I use the following statement to create a JEditorPane
    JEditorPane htmlpane = new JEditorPane("http://sulu.informatics.indiana.edu/6S/network/");
    The static text is showing, but the applet graph is always missing. Do I need to do something else? Please help me!

    JEditorPane's abilities to show HTML are very limited. It doesn't support CSS, JavaScript, applets and many other things. You'll need a real browser component for that.

  • Destroy applet

    Hello,
    I have an applet that loads a dialog box when it is started. The dialog box is a login dialog box. I have OK and CANCEL buttons in it. If I press CANCEL, I need to close the dialog box and close the destroy the applet too. Is it possible?
    I should not allow the user to see the applet if the login fails. Any ideas?
    Thanks

    The applet is not exited by any programmatic means--but that shouldn't be necessary, as the applet is nothing more than a dead corpse after a failed login. It's not doing anything besides hanging around, and there are no user interface components, so nothing can be triggered as well. If you need to hide the page, you can do
    getAppletContext().showDocument(new URL("http://some.other.url/"));and divert to a different page. Actually I don't think that it is possible to, well, kind of unload the applet from the page once it has been loaded--at least not by investing nothing more than reasonable efforts. Maybe there is a way using javascript--applet interoperation an dynamic HTML, but I'm not sure whether it's worth trying.
    Regards

  • Java applet freeze completly browser

    Hi there
    Ive created a smalle board game in an ASP / Javascript page. The game is multiplayer and i connect everybody via an java applet to a java server.
    Well, it look like this :
    ASP / Javascript --> Applet --> JavaServer --> Applet --> ASP / javascript
    The game is just fine and completly functionnal. The problem is : We just brought in some video for the players who have Webcams. And those video freeze when the applet is waiting a response from the server. Is there anyway that the applet does not freeze the whole browser so that the video continu playing even if the game is waiting?
    the main window contain 2 sections, �video & chat� and the game. The game containt a few frames with one of them containing the applet. In the java applet, im using BufferedReader and PrintWriter with AppletSocket to communicate with the server.
    Im not sure if i have made myself clear, if not, tell me, ill try to make it clearer.
    Thanks in advance
    Marc
    P.S. sorry for my english

    There maybe some code will help most of you to understand better my problem.
    Here's the function in my asp pages that wait for the applet response.
    function AttendreReponse()
         AppletConnect.Recevoir();
         GererRecevoir();
    }The javascript function 'GererRecevoir()' get the code that was sent by the server, analyse it and then, do run the proper function so the game can go on normally..
    And here's the java function 'Recevoir()' in the applet
    public void Recevoir()
      // String received from the server
      String fromServer = "";
      this.paramTransaction = "";
      this.codeTransaction ="";
      try{
        // Reads the string received
        fromServer = this.in.readLine();
        if(fromServer != null)
          this.codeTransaction = fromServer.substring(0,2);
          if(fromServer.length() > 2){
            this.paramTransaction = fromServer.substring(2); //retrieve the 2 next ^^
      // Applet dosent receive anything anymore from the server
      catch (IOException e){
        System.out.println("Le serveur n'est plus en fonction");
        System.exit(1);
    }So the main problem is that the applet freeze the whole window then ge gets to : fromServer = this.in.readLine();
    He wait until he get a response or untill he timeout.
    What I would like, is that the applet does not freeze the whole window while waiting since videoconference, chatting and sound arent very usefull if you can use them 3/4 of the time.
    I hope this helped you to understand a little bit more.
    Thanks again
    Marc

  • Java to Javascript

    Can anyone tell me why the following javascript & Applet code work fine in IE 6.0, but fails missably with Netscape 7.0? It works fine with IE but not with Netscape. Do I need a .jar file from netscape to include as part of my compile parameters?
    The HTML javascript code looks like this:
    <html>
    <head>
    <script language="JavaScript">
    var message="Hi from JavaScript";
    function changeMessage()
    var message="Hi from Java";
    document.form1.messagefield.value=message;
    </script>
    </head>
    <body>
    <form name="form1">
    <input name="messagefield" type="text" size="30" value="Hi from FORM">
    </form>
    <applet name=MyApplet code=JavaApplet1 width="600" height="200"> MAYSCRIPT></applet>
    </body>
    </html>
    with the following applet:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import netscape.javascript.*;
    public class JavaApplet1 extends Applet implements ActionListener
    public void init()
    try
    documentWindow = JSObject.getWindow(this);
    catch(Exception e)
    System.out.println("Error: "+e.getMessage());
    button = new Button("Talk to Script");
    add(button);
    button.addActionListener(this);
    public void actionPerformed(ActionEvent e)
    String[] args = {""};
    documentWindow.call("changeMessage",args);
    private JSObject documentWindow;
    private Button button;
    }

    The first thing I notice is a tag mis-match in the HTML.
    MAYSCRIPT>
    ...doesn't go with anything.

Maybe you are looking for