Calling a Java Applet - Javascript

Hey guys,
I'm still fairly new to Java. I'm having a hard time getting my Applet to run properly.
Basically, this is what I want it to do:
I have a web page with a series of fields on it (a form). I have a submit button. When the user clicks the submit button, it activates a Javascript function in a seperate file that validates ALL of these fields. The validation that it does is merely to determine whether or not the fields are blank.
Once it's accomplished this task, I THEN want it to run a Java applet.
Everything works up until the point at which it runs the Java applet. I'm not sure how exactly I'm supposed to call the applet from Javascript.
In every example of a web page that I see that has an applet, it has something that looks like this:
<APPLET CODE="classname.class >
</APPLET>That's all fine and good, but the problem is that it automatically calls the Applet then. I don't want it to do that. Is there a way that I can CALL the applet at the very end of a JS file? I mean, I don't want anything to load, no grey boxes or any of that stuff until I actually call it..
Any idea?
Thanks!
Todd

dude,
have you managed to call an applet method from firefox?
I'm not sure it is working at all.
I've read few articles and everyone is complaining about the same error:
Error: document.appl01 has no properties
in the case above the applet was called "appl01"
I've tried using
document.applets[0].<the applet method>
and I've got the same result..

Similar Messages

  • JavaScript call to Java applet

    Sorry if this message get posted twice, but I haven't seen the 1st. I sent.
    I seem to have a problem with a form trying to call an applet. I hava a button like this:
    <input type=button value="Add" onClick="Nota.addRow('2','3','12.80','Cacahuates Mafer 1/2 kg.')">
    my Nota.addRow method is thisone:
    public void addRow (String idS, String qtyS, String priceS, String desc) {
    int id= Integer.parseInt (idS);
    int qty= Integer.parseInt (qtyS);
    float price= Float.parseFloat (priceS);
    remove (total);
    renglones[renglonCnt]= new Renglon (id,qty,price,desc);
    add (renglones[renglonCnt]);//<- This line is not adding the Row when i call it from JavaScript. Otherwise it works just fine...
    //total= Renglon.Total();
    //add (total);
    System.out.println("El id es: " + Integer.toString(id));
    System.out.println("La cantidad es: " + Integer.toString(qty));
    System.out.println("El precio es: " + Float.toString(price));
    System.out.println("La descripcion es: " + desc.toString());
    System.out.println("El precio del objeto es: " + Float.toString(renglones[renglonCnt].getTotal()));
    renglonCnt++;
    Altough my addRow works when I callit from a Nota object it doesn't when i call it from javascript.
    total is just a panel that you get from class Renglon.
    And Renglon is a Panel class too.
    I'll appreciate any help, thanks.
    Jeronimo

    Hey, that's really good news, does it actually adds the row to the applet and gets the new total?!
    Anyway, i tried 1.) (wich describes the applet quite well) and 2.) but still doesn't works for me. Also changed the "price" line...
    Im using:
    Navigator 4.72
    IE 5.50
    Netscape 6
    Here's the html code (the form):
    <form>
    <table border=5 WIDTH=500 align=center>
    <tr>
    <TD width=30%>
    <table border=1 width="100%" >
    <tr>
    <th WIDTH="20%"> Cantidad </th>
    <th WIDTH="26%"> Descripci&oacute;n </th>
    <th WIDTH="20%">Precio Unitario</th>
    <th WIDTH="20%"> Agregar </th>
    </tr>
    <tr>
    <td WIDTH="20%" align=center>
         <input size=2 name=cantidad maxlength=2>
         </td>
    <td WIDTH="26%">
         Cerveza Sol 600ml.
         </td>
    <td WIDTH="20%">
         $15.50
         </td>
    <td WIDTH="20%" align=center>
         <input type=button value="Add" onClick="document.Nota.addRow('1','12','15.50','Cerveza-Sol-600ml.')">
         </td>
    </tr>
    <tr>
    <td WIDTH="20%" align=center><input size=2 maxlength=2></td>
    <td WIDTH="26%">
         Cacahuates Mafer 1/2 kg.
         </td>
    <td WIDTH="20%">
         $12.80
         </td>
    <td WIDTH="20%" align=center>
         <!--<input type=button value="Add" onClick="Nota.addRow('2','3','12.80','Cacahuates Mafer 1/2 kg.')">
         -->
         <input type=button value="Test" onClick="alert (Nota)"
         </td>
    </tr>
    <tr>
    <td WIDTH="20%" align=center><input size=2 maxlength=2></td>
    <td WIDTH="26%"> </td>
    <td WIDTH="20%"> </td>
    <td WIDTH="20%" align=center>
         <input type=button value="Add">
         </td>
    </tr>
    <tr>
    <td WIDTH="20%" align=center><input size=2 maxlength=2></td>
    <td WIDTH="26%"> </td>
    <td WIDTH="20%"> </td>
    <td WIDTH="20%" align=center><input type=button value="Add"></td>
    </tr>
    </table>
    </td>
    <td width="40%">
    <applet name=Nota code=Nota.class width=350 height=250> </applet>
    </td>
    </tr>
    <tr>
    <td colspan=2 align=center>
    <input type=button value="Enviar Pedido">
    </td>
    </tr>
    </table>
    </form>
    Here's the Nota applet code:
    import java.awt.*;
    import java.applet.*;
    public class Nota extends Applet {
    private Renglon renglones[];
    private BarraTitulo titulo;
    private int renglonCnt;
    private Panel total;
    public void init () {
    setLayout (new GridLayout(12,1));
    renglonCnt=0;
    renglones= new Renglon [10];
    total= Renglon.Total();
    public void start () {
    String titulos[]= new String [4];
    titulos[0]="(-) Cantidad (+)";
    titulos[1]="Descripcion";
    titulos[2]="Precio Unitario";
    titulos[3]="Total";
    titulo= new BarraTitulo (titulos,12);
    add (titulo);
    add (total);
    public void addRow (String idS, String qtyS, String priceS, String desc) {
    int id= Integer.parseInt (idS);
    int qty= Integer.parseInt (qtyS);
    //float price= Float.parseFloat (priceS);
    float price= Float.valueOf (priceS).floatValue();
    remove (total);
    renglones[renglonCnt]= new Renglon (id,qty,price,desc);
    add (renglones[renglonCnt]);
    //total= Renglon.Total();
    //add (total);
    //THESE LINES SHOW EVERTHING WELL IN THE JAVA CONSOLE, BUT THESE ARE JUST FOR DEBUG. System.out.println("El id es: " + Integer.toString(id));
    System.out.println("La cantidad es: " + Integer.toString(qty));
    System.out.println("El precio es: " + Float.toString(price));
    System.out.println("La descripcion es: " + desc.toString());
    System.out.println("El precio del objeto es: " + Float.toString(renglones[renglonCnt].getTotal()));
    renglonCnt++;
    This is the Renglon class code:
    import java.awt.*;
    import java.awt.event.*;
    public class Renglon extends Panel implements ActionListener {
    private TextField qty, description, up, total;
    private Button more, less;
    private int cantidad, identificador;
    private float unitP;
    private String descripcion;
    static float elTotal= 0;
    static Panel totalP= new Panel();
    static Label c4tot= new Label();
    public Renglon () {
    this(1, 1, (float) 2.50, "Algun articulo");
    public Renglon (int id, int q, float pu, String desc) {
    identificador= id;
    cantidad= q;
    unitP= pu;
    descripcion= desc;
    elTotal+= cantidad * unitP;
    Panel addsub;
    setLayout (new GridLayout (1,4));
    addsub= new Panel();
    addsub.setLayout(new GridLayout(1,3));
    less= new Button ("<<");
    more= new Button (">>");
    less.addActionListener (this);
    more.addActionListener (this);
    Integer c= new Integer (cantidad);
    qty= new TextField (c.toString());
    description= new TextField (descripcion);
    Float x= new Float (unitP);
    up= new TextField ("$" + x.toString());
    Float t= new Float (getTotal());
    total= new TextField ("$" + t.toString());
    qty.setEditable (false);
    description.setEditable (false);
    up.setEditable (false);
    total.setEditable (false);
    addsub.add (less);
    addsub.add (qty);
    addsub.add (more);
    add (addsub);
    add (description);
    add (up);
    add (total);
    setVisible (true);
    public float getTotal () {
    return ((float) cantidad*unitP);
    public void actionPerformed (ActionEvent e) {
    if (e.getActionCommand().equals("<<")){
    cantidad--;
    elTotal-= unitP;
    if (cantidad < 0) {
    cantidad=0;
         elTotal+= unitP;
    } else {
    cantidad++;
    elTotal+= unitP;
    Float nuevoTot= new Float (getTotal());
    Integer c= new Integer (cantidad);
    qty.setText (c.toString());
    total.setText ("$" + nuevoTot.toString());
    Float et= new Float (elTotal);
    c4tot.setText("$" + et.toString());
    static public Panel Total () {
    totalP.setLayout (new GridLayout(1,4));
    Label c1,c2,c3;
    Float totalF= new Float (elTotal);
    c1= new Label("");
    c2= new Label("");
    c3= new Label("Total:");
    c4tot= new Label("$" + totalF.toString());
    totalP.add(c1);
    totalP.add(c2);
    totalP.add(c3);
    totalP.add(c4tot);
    totalP.setVisible(true);
    return (totalP);
    And just in case, this is the BarraTitulo class code:
    import java.awt.*;
    public class BarraTitulo extends Panel {
    public BarraTitulo (String [] titulos) {
    this (titulos,15);
    public BarraTitulo (String [] titulos, int size) {
    Label labels;
    Font ft= new Font("Serif",Font.BOLD, size);
    int length= titulos.length + 1;
    setLayout (new GridLayout (1,length));
    setFont (ft);
    for (int i=0; i< titulos.length; i++) {
    labels= new Label(titulos);
    add (labels);
    Thanx again for your time.
    Jeronimo

  • IE6 leaks "Handles" when calling *ANY* Java applet

    Hello all IE experts,
    It seems that IE has "Handles" leak when it calls Java Applet.
    Every call to a Java method from JavaScript, IE allocate a handle and does
    not free it.
    THIS DOES NOT HAPPEN when I use mozilla or Netscape.
    Versions:
    * Windows 2000 SP 3 (The most recent, with all fixes of hfnetchk)
    * Internet Explorer (The most recent one, with all fixes of hfnetchk)
    Version 6.0.2800.1106
    SP1
    Q328970
    Q324929
    Q810847
    Q813951
    * Java Plug-in - 1.4.1_02-b06
    If you compile the applet and use the test html, then press "Test" you will
    notice that 1000 (or more) handles are allocated (At Windows Task Manager).
    If you press again you will see that another 1000 (or more) handles are
    allocated. The handles are NEVER released, even if you browse to other
    sites. You can enjoy this process until there are no more handles to
    allocate... :)
    Notice that the applet I use does nothing... I've checked this with various
    of applets on the web and the results are the same.
    Can anyone help?
    Best Regards,
    Alon Bar-Lev
    ** The following html is used: (test1.htm)
    <html>
    <head>
    <script LANGUAGE="JavaScript">
    function OnTest () {
    for (var i=0;i<1000;i++) { a1.method1 (); }
    </script>
    </head>
    <body>
    <input type=button onclick="OnTest ()" value="Test"></input>
    <APPLET code="test1.applet1.class" archive="test1.jar" id="a1" name="a1">No
    Java</APPLET>
    </body>
    </html>
    ** The following applet: (test1/applet1.java)
    package test1;
    import java.applet.*;
    public class applet1 extends Applet {
    public void method1 () {}
    ** The following makefile: (Makefile)
    JAVAC="$(J2SE)\bin\javac" -classpath $(CLASSPATH)
    JAR="$(J2SE)\bin\jar" -cvf
    CLASSPATH=.
    all:
    $(JAVAC) test1/*.java
    $(JAR) test1.jar test1/*.class

    New information:
    This happens from Java version 1.4.0_01.
    This did not happen in Java version 1.4.0.
    Alon.

  • Calling a java applet

    Hi all
    I have made a java applet, which gets some client machine
    information. I have to call that applet from my form. Is there
    any way to do so. Also is there any way that my applet which
    gets the installed printer on client machine, can pass the name
    of the printer to the calling form ???

    To call an applet you can use web.show_document builtin to call
    an html page that activates the applet.
    To pass parameters to form you can have your applet write the
    info to the database or the server's file system and then have
    form read it from there.
    You might also be interested in the ability to have a Javabean
    inside a form that can communicate with the form directly.

  • Unix script call from java applet

    In perl you can use the system command to call a unix command like mv or ls. How do run a unix command from a java applet?

    normaly java applets are not allowed to execute any code. But there is a possibility to ask the user to be allowed to..
    in Netscpae you can use the following:
    import netscape.security.PrivilegeManager;
    then somewhere in the class...
    PrivilegeManager.enablePrivilege( "UniversalExecAccess" );
    then the user can press 'grant' or 'deni'. If he pressed grant, you can do the following:
    Process process = Runtime.getRuntime().exec( "command" );
    //where command is what ever command you like to execute
    hope that helps.
    lexip

  • I'm trying to develop a PKI enabled plugin for firefox using add-on builder. how do you call a java applet using add-on javascript on add-on builder ?

    i have a signed applet which encrypts and digitally signs text information. i need to call this applet from the add-on javascript on firefox's add-on builder . how do i do it ?
    i've tried using contentScript and contentScriptFile to load the html file which calls the applet vis applet tag , it doesnt work.
    this is the error which croped up:
    Java Plug-in 1.6.0_26
    Using JRE version 1.6.0_26-b03-383-11A511 Java HotSpot(TM) 64-Bit Server VM
    User home directory = /Users/sreer1990
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    java.lang.NullPointerException
    at sun.net.www.ParseUtil.toURI(ParseUtil.java:261)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:861)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
    at sun.plugin.PluginURLJarFileCallBack.downloadJAR(PluginURLJarFileCallBack.java:81)
    at sun.plugin.PluginURLJarFileCallBack.access$000(PluginURLJarFileCallBack.java:48)
    at sun.plugin.PluginURLJarFileCallBack$2.run(PluginURLJarFileCallBack.java:150)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin.PluginURLJarFileCallBack.retrieve(PluginURLJarFileCallBack.java:127)
    at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:186)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:50)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(CachedJarURLConnection.java:201)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(CachedJarURLConnection.java:145)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(CachedJarURLConnection.java:91)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(DeployURLClassPath.java:752)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(DeployURLClassPath.java:631)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(DeployURLClassPath.java:698)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(DeployURLClassPath.java:690)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(DeployURLClassPath.java:652)
    at com.sun.deploy.security.DeployURLClassPath$3.run(DeployURLClassPath.java:400)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(DeployURLClassPath.java:389)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(DeployURLClassPath.java:366)
    at com.sun.deploy.security.DeployURLClassPath.getResource(DeployURLClassPath.java:230)
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Plugin2ClassLoader.java:966)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Plugin2ClassLoader.java:955)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:134)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:250)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:240)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:161)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:675)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3046)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1498)
    at java.lang.Thread.run(Thread.java:680)
    Exception: java.lang.NullPointerException

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • Firefox 2.0.0.8 = security alert when calling a Java applet method

    I have a JavaHelp applet that I launch using a method that I called
    from JavaScript when a user clicks on a link.
    A problem I found with Firefox 2.0.0.8 and JRE 1.4 is that when I
    click on the link it will try to display a security alert window, but
    the window appears to freeze up when it is being displayed and hangs
    the browser. For example, I cannot see any of the buttons that should
    be on the security window. Rather the main window is empty. However,
    if my applet exposes a button that the user can directly click, the
    security window displays properly and can be dismissed.
    With the same JavaHelp applet, the link works fine if I use it Firefox
    2.0 and JRE 1.6 or JRE 1.5, and with IE 6.0 and IE 7.0. I uninstalled
    and reinstalled Firefox with JRE 1.4, and I couldn't reproduce the
    problem. However, I'm concerned that this problem may resurface in
    the future.
    Has anyone ever seem a similar problem? And if so, are there any easy
    workarounds?

    >
    I have a JavaHelp applet.. >I suggest you launch it using Java Web Start (JWS).
    Here is a test of a direct launch of the HelpButton JavaHelp applet.
    <http://www.physci.org/jh/test.html#launch>
    It would only take minor changes to the code to make the button entirely redundant, and have the code automatically launch the HelpViewer, once the user clicks the link to the JNLP launch file.
    That 'JavaHelp/JWS' page is my test page for launching JavaHelp in a variety of forms.

  • Java Applet to Javascript Communication

    There is a Java Applet which digitally signs files after taking
    private key from a smart card.This applet takes external files.
    I want to do this "Generate digital signature of a web page with the
    help of an applet of which the applet is itself a part"
    I am trying using Java Applet to Javascript Communication.
    I am able to access the object which represents the HTML document.
    That abject is represented by document itself.
    Now I have to somehow generate the whole webpage i.e. like we view in a
    notepad like this:
    <HTML>
    <Title>my page</title>
    Then write into a file and then that file can be signed.
    This is what I feel.
    In C#.net there is a method .innerhtml.
    Does such kind of a method exists in Java.???
    I m searching but cudn't get till now.
    Will serialization work??

    Kindly forget the previous post. Read the following:
    JSObject browserWindow = JSObject.getWindow(this);
    JSObject doc = (JSObject)browserWindow.getMember("document");
    Here doc represents the object of the HTML document.
    This is accessed using Java Applet JavaScript Communication.
    I want to serialize the object represented by doc.
    Then write it into a file and generate it's digital signature.
    In the below written line the parameter fileName is passed.
    CertificationChainAndSignatureBase64 signingResult = signFile(fileName);
    For this I have added few lines in the code written below.
    see first 10-30 lines. Though this code gets compiled but it is not running. When I want to sign the file , it throws an error
    "Unexpected error:sun.plugin.javascript.ocx.JSObject"
    This code is just one class. Two other classes are needed to completely test the code.
    Should I post them ??
    Kindly see what is the error.
    I will be highly grateful and Sorry for confusing in the previous mail...
    private void signSelectedFile() {
    try {
    // Get the file name to be signed from the form in the HTML document
    JSObject browserWindow = JSObject.getWindow(this);
    JSObject mainForm = (JSObject) browserWindow.eval("document.forms[0]");
    String fileNameFieldName = this.getParameter(FILE_NAME_FIELD_PARAM);
    JSObject fileNameField = (JSObject) mainForm.getMember(fileNameFieldName);
    //This is another modification
    //String fileName = (String) fileNameField.getMember("value");
                   //here we get the document......
    JSObject doc = (JSObject)browserWindow.getMember("document");
    //String docum = doc.toString();
    String thePage = "as";
                   FileOutputStream out = new FileOutputStream(thePage);
                   ObjectOutputStream s = new ObjectOutputStream(out);
                   s.writeObject(doc);
                   String fileName = thePage;
                   JOptionPane.showMessageDialog(this, fileName); //"Unexpected error: " + e.getMessage());
    // Perform the actual file signing
    CertificationChainAndSignatureBase64 signingResult = signFile(fileName);
    if (signingResult != null) {
    // Document signed. Fill the certificate and signature fields
    String certChainFieldName = this.getParameter(CERT_CHAIN_FIELD_PARAM);
    JSObject certChainField = (JSObject) mainForm.getMember(certChainFieldName);
    certChainField.setMember("value", signingResult.mCertificationChain);
    String signatureFieldName = this.getParameter(SIGNATURE_FIELD_PARAM);
    JSObject signatureField = (JSObject) mainForm.getMember(signatureFieldName);
    signatureField.setMember("value", signingResult.mSignature);
    } else {
    // User canceled signing
    catch (DocumentSignException dse) {
    // Document signing failed. Display error message
    String errorMessage = dse.getMessage();
    JOptionPane.showMessageDialog(this, errorMessage);
    catch (SecurityException se) {
    se.printStackTrace();
    JOptionPane.showMessageDialog(this,
    "Unable to access the local file system.\n" +
    "This applet should be started with full security permissions.\n" +
    "Please accept to trust this applet when the Java Plug-In ask you.");
    catch (JSException jse) {
    jse.printStackTrace();
    JOptionPane.showMessageDialog(this,
    "Unable to access some of the fields of the\n" +
    "HTML form. Please check the applet parameters.");
    catch (Exception e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(this, "Unexpected error: " + e.getMessage());
    }

  • Run Priviliged Code in a Java Applet

    I am calling a Java applet from Javascript. The Java code needs to run in privileged mode.  Eventually it is going to display a file chooser which will display files from the local hard disk, but for now it just returns a simple dummy value.  The problem I am having is that the call from JavaScript to Java returns PrivilegedActionException. The applet is in a signed Jar file.  I'm running 8u25.
    Here's the Java class:
        // Java code
        public class OHLib extends Applet {
            public String getFile() {
                String result;
                try {
                    result = (String) AccessController.doPrivileged(new PrivilegedAction() {
                        public String run() {
                            // JFileChooser code will go here
                            return "xxx";
                } catch (Exception e) {
                    e.printStackTrace();
                return result;
    Can anybody tell me what's wrong with this code?  I would also be interested to know why the above try/catch block is not catching the exception.  The only place I see the exception is in the browser F12 developer tools.
    Here's the JavaScript code:
        function BrowseForFile() {
            var x;
            try {
                 // this code generates PrivilegedActionException
                 x = ohApplet.getFile();
            } catch (e) {
                 console.log(e);
    The applet is deployed on my web page as follows:
    <script src="/plugins/deployJava.js"></script>
    <script>
         var attributes = {
             id:'ohApplet',
             code:'OHLib',
             codebase: 'java',
             archive: 'OHLib.jar',
             width:1,
             height:1,
         var parameters = {
          jnlp_href: 'OHLib.jnlp',
          classloader_cache: 'false',
         deployJava.runApplet(attributes, parameters, '1.8');
    <script>
    The applet is in a signed jar file, with the following manifest:
    Application-Name: <appname>
    Permissions: all-permissions
    Codebase: <domain>.dev <domain>.com
    Caller-Allowable-Codebase: <domain>.dev <domain>.com
    Application-Library-Allowable-Codebase: <domain>.dev <domain>.com
    The JNLP file is as follows:
        <?xml version="1.0" encoding="UTF-8"?>
        <jnlp spec="1.0+" codebase="" href="">
            <information>
                <title>title</title>
                <vendor>vendor</vendor>
            </information>
            <security>
                <all-permissions />
            </security>
            <resources>
                <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se" />
                <jar href="OHLib.jar" main="true" />
            </resources>
            <applet-desc
                 main-class="OHLib"
                 name="OHLib"
                 width="1"
                 height="1">
             </applet-desc>
        </jnlp>       

    The problem was that I was not including the anonymous inner class (OHLib$1.class) in the jar file. My original jar command looked like this:
    jar cfmv OHLib.jar "../../jar_manifest.txt" OHLib.class
    Changing it to below fixed the problem:
    jar cfmv OHLib.jar "../../jar_manifest.txt" OHLib.class OHLib$1.class
    Credits go to this page  for the solution.

  • Type Mismatch error while calling a Java Function from Visual Basic 6.0...

    Hi,
    I'm having a problem in calling the Java Applet's Function from Visual Basic. First, I'm getting the handle of the Java Applet and components of it using "Document.Applets(n)" which is a HTML function. I'm calling this function from Visual Basic. My code is something like this...
    ' // Web1 is IE Browser in my Form.
    Dim Ap,Comp
    Dim Bol as Boolean
    Bol = true
    Ap = Web1.Document.Applets(0).getWindow() ' \\ Gets the Parent Window.
    Ap.setTitle("My Java Applet") ' \\ Sets the Title of the window.
    msgbox Ap.getVisibility() ' \\ This will return a Java boolean ( true or false )
    Ap.setVisibility(Bol) ' \\ Function Syntax is : void setVisibility(boolean b)
    Here in my code , i'm able to call any function that which accepts Integer or String but not boolean. So, i m facing problem with Ap.setVisibility() function. It gives me a "Type mismatch error" while executing it. Can you please tell me a way to do this from Visual Basic !
    I'm using Visual Basic 6.0, Windows 2000 , J2SDK 1.4.2_05.
    Please help me Friends.
    Thanks and Regards,
    Srinivas Annam.

    Hi
    I am not sure about this solution. try this
    Declare a variable as variant and store the boolean value in that variable and then use in ur method.
    Post ur reply in this forum.
    bye for now
    sat

  • Embedded Java Applet NullPointerException in JSPX pages

    We have a ADF web application programmed in JDeveloper 11g (11.1.2.4.0), which was migrated over from a 10g (10.1.3.5.0) project
    Within the application, occasionally, we need to call a Java Applet which is placed in a public_html/applet folder. The jars show up in the Web-Content tab of the ViewController in the Application Navigator, just like it did in 10g.
    The applet tag looks like this:
    <applet height="100" width="100" code="applet.SetupApplet" archive="applet/SSetupApplet.jar">
                <param name="debug" value="true"/>   
    </applet>
    I've also tried calling the applet with the Java deploy applet script
    <trh:script source="http://java.com/js/deployJava.js"></trh:script>
        <trh:script>
            var attributes = {code:'applet.SetupApplet',
            archive:'applet/SSetupApplet.jar'};
            var parameters = {} ;
            var version = '1.6' ;
            deployJava.runApplet(attributes, parameters, version);
       </trh:script>
    When I navigate to the login.jspx page that has this tag, it pops the Java Console open, but doesn't actually run the applet (or show the prompts to allow using the Applet). Instead, the applet is shown with an error and the error says "NullPointerException". I've double-checked the path and it's correct (with incorrect paths, I get a ClassNotFoundException). In the application server logs, I see the following error:
    <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on IPADDRESS during the configured idle timeout of 5 secs>
    I created a normal .jsp file that's outside the ADF Faces Context in the applet folder. Navigating to it with the same applet tags does have the Java applet run without the socket error. The same code in 10g works fine.
    Is there anything I'm missing?
    Thanks.

    Hi,
    this is how I did it in 11g R1: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/71-adf-to-applet-communication-307672.pdf
    Frank

  • Java Applet call javascript problem

    Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
    HTML:
    ================================================================
    <HTML>
         <HEAD>
         function ShowEmbd()
              alert("Test Applet call Javascript");
         </SCRIPT>
         </HEAD>
         <BODY>
         <FORM NAME="AppletEmbdStart">
              <OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
              <APPLET code="MyApplet.class" width="0" height="0"></APPLET>
         </FORM>
         </BODY>
    </HTML>MyApplet.java
    =========================================================================
    import netscape.javascript.*;
    public class MyApplet extends javax.swing.JApplet
         private JSObject m_win = null;
         private JSObject m_doc = null;
         public void init()
              getJSWin().call("ShowEmbd", null);
         private getJSDoc()
              if(m_doc == bull)
                   m_doc = (JSObject) getJSWin().getMember("document");
              return m_doc;
         private JSObject getJSWin()
              if (m_win == null)
                   m_win = netscape.javascript.JSObject.getWindow(this);
              return m_win;
    }The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
    The browser shows a message from status bar "The applet not initial" ???? why ???
    Can anyone help ?!

    On first look:
    I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript.

  • Call Javascript Function in my JAVA Applet

    Hello every body,
    I would like to be able to call a javascript function in my Java applet.
    I know to call JAVA function with a javascript function but not inverse.
    Someone can help me please ?

    Look at chapters 25/26 (or so) in Sun's Plugin Developer's Guide.

  • Javascript to applet calls with Java Plugin

    Hello,
    I'm working on getting existing applets to work with Sun's Java Plugin (v 1.3.1_03). I'm not sure how to modify calls to the applet from JavaScript. For example:
    document.applets[0].getClientHomeFromEnvironment();
    This works fine using the regular browser VM in IE or Netscape, but is not valid when using Sun's Plugin. I found the following in the Developer FAQ:
    Q: Does Java Plug-in support Java-JavaScript communication?
    A: Yes, Java Plug-in supports basic, bidirectional Java-JavaScript communication. The following, however, is a known incompatibility.
    In the Microsoft implementation, applet methods and properties exposed in JavaScript are exactly the same as the methods and fields in the applet object. In Java Plug-in, an applet's methods and properties are exposed in JavaScript through JavaBeansTM introspection, which treats the applet's fields in a different manner than the Microsoft VM. Therefore, JavaScript accessing fields in an applet object may not work the same when run on JRE/Java Plug-in.
    But it's still not clear to me how I would go about calling the applet. Has anyone done this successfully?
    Thanks,
    -Dave Meier.

    Yes and no....
    I'm using the internal browser JVM when the user has NS < 6.0 and IE < 5.0. But.. if they have NS 6.0+ or IE 5.0+ and have the browser configured properly, it hands off to the plugin. That does work.
    If you must use the OBJECT or EMBED tags... Your best bet are the release notes for the plugin to see what they say about Java-JavaScript support. You could start here...
    http://java.sun.com/products/plugin/1.3/enhancements/oji.html
    JZ

  • JavaScript calls method on Java Applet-- Problem

    Hi all,
    I have a problem as following:
    I have a method on JavaScript calling a method on Java Applet. A method on JavaScript repeatedly retrieves data form the server , let's say; every 100 ms and it calls the method on Java to draw a graph(I use thread to call repaint()). The problem is, if I leave the applet site(or the site has lost the focus), the stop() will be called and I can't recieve data from JavaScript anymore. If I go back to the site, the applet starts, but the graph doesn't show the figure, as it supposes to show.
    how can I tell the browser doesn't call the stop() or there is another way to solve this problem?
    Thanks for all answers. CU.
    A-Pex

    my own fault.. it's not the browser or the applet.. It's my computer.. it's too old for this applet..
    Does anyone know, how to optimize the applet with thread? thanks..

Maybe you are looking for

  • F-28 Incoming payment BSEG-XREF1/2 & BSEG-XREF3 grayed out on clearing line

    We apply payment Using SAP standard transaction code F-28 - post  incoming payment. Business requirement is to capture Reference Key 1/2 & Reference Key 3 are on  cleared as well as partial line items. Populating these fields will help reconciliation

  • ColdFusion 11 Questions

    I have a few questions about CF 11. I have just installed CF 11 on a Windows 8 server. This is an all new server and software installation. It isn’t to where it can be viewed outside of our network just yet until we have everything installed and runn

  • TS1496 when updating iTunes to latest version windows error message appears

    when updating iTunes to latest version windows error message appears

  • How to display kWh cumulative?

    Hi All, I am writing a simple labview program to display and monitor a Solar farm installation (code attached). I have all working properly, data is taken from my DAQ and displays power consumption of our plant compared to power generated by solar fa

  • Slides Squished with DVD SD

    Here is my problem, I have slides that at 720x480px at 150dpi that I import into DVDSP. When I create slideshows, the images are "Squished" when I view them with the Simulator. I have the viewer set to 4:3 letterbox. I don't understand! My slides loo