title: How to call functions in jar file using javascript in html file?
body: <p>I want to call functions in a java file using javascript . Please help me to achieve this. I went through a tutorial at </p>
  
  <p><a href="https://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html" rel="nofollow">https://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html</a> </p>
  
  <p>but I couldn't understand properly attributes like code: , jnlp_href: etc. I just read and then I made minor changes in values what I felt necessary. </p>
  
  <p>I have a folder wherein I have html file: index.html, jar file:Example.jar and a class file : Example.class </p>
  
  <p>Following is my html code :  index.html</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"/&gt;
  &lt;script src="https://www.java.com/js/deployJava.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  &lt;!-- applet id can be used to get a reference to the applet object --&gt;
      var attributes = { id:'app', code:'Example',  width:1, height:1};
      var parameters = { jnlp_href: 'Example.jnlp'};
      deployJava.runApplet(attributes, parameters, '1.6');
  &lt;/script&gt;
  &lt;script language="javascript"&gt;
    function openMsg()
   { 
       var msg = app.getMessage();     
       document.getElementById("print").innerHTML = msg;      
   }       
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;button onclick="openMsg();"&gt;Click to open message&lt;/button&gt;
  &lt;p id="print"&gt;&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My java file : Example.java </p>
  
  <pre><code>import java.awt.Color;
  import java.awt.Graphics;
  
  import javax.swing.JApplet;
  
  public class Example extends JApplet{
  
     public void start()  
    {
  
    }
  
     public void init()   
    {
      setBackground(Color.blue);
    }
  
     public void paint(Graphics g)    
    {
       g.drawString("Hello World !", 100, 100);
    }
  
     public void getMessage()
    {
        System.out.println("Good Morning..!!!");
    }
  
   }
  </code></pre>
  
  <p>My objective in this program is whenever I click on the button, javascript should call getMessage() function from the jar file and then display Good Morning on the screen.</p>
  
  <p>But presently I am not getting the desired results. Please help me with this..</p>