jnlp not working

Hallo,

I am trying a little jnlp project. The java file is attached with this . I am also sending launch.html for your reference





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- ########################## IMPORTANT NOTE ############################ -->
<!-- This preview HTML page will work only with JDK 6 update 10 and higher! -->
<!-- ###################################################################### -->
<html>
    <head>
        <title>Test page for launching the applet via JNLP</title>
    </head>
    <body>
        <h3>Test page for launching the applet via JNLP</h3>
        <script src="http://java.com/js/deployJava.js"></script>
        <script>
            var attributes = {
                code:       "mypackage.MyOwnJApplet",
                archive:    "NextGenApplet.jar",
                width:      300,
                height:     300
            };
            var parameters = {jnlp_href:"launch.jnlp"}; <!-- Applet Parameters -->
            var version = "1.6"; <!-- Required Java Version -->
            deployJava.runApplet(attributes, parameters, version);
        </script>
        <!-- Or use the following applet element to launch the applet using jnlp_href -->
        <!--
        <applet width="300" height="300">
            <param name="jnlp_href" value="launch.jnlp"/>
        </applet>
        -->
    </body>
</html>




I am using Netbeans 7.0.1, Windows 7. When I am right clicking on "launch.html" and select view, only

"Test page for launching the applet via JNLP"

this line is comming in browser. Nothing else. I am expecting a textbox with "Hello World !!!". But it is not comming. Anything wrong in my code?

I have done the following steps also, Project->Properties->Check on Enable Web Start->Check Off Allow Offline->Signing->Self signing by generated key->Applet descriptor->mypackage.MyOwnJApplet

Please help
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MyOwnJApplet.java
 *
 * Created on Oct 13, 2011, 10:55:01 AM
 */
package mypackage;

/**
 *
 * @author SRY_5693
 */
public class MyOwnJApplet extends javax.swing.JApplet {

    /** Initializes the applet MyOwnJApplet */
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {

                public void run() {
                    initComponents();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /** This method is called from within the init() method to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("Hallo World !!!");
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>                        
    // Variables declaration - do not modify                     
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration                   
}

Open in new window

Amitava_MukherjeeAsked:
Who is Participating?
 
for_yanCommented:
If you wrote your application as an applet extending JApplet class - there is no need to use JNLP which is used for deploying the
Applications (not Applets). When you extend JApplet - these classes are stored on the server and are downloaded ferom the server when the user
points brwoser to the html page which has applet tag.
Then they are executed within briowser (so classes are not written to local drive of the client).

If you write Appliaction (usually extend JFrame), then Java webstart and jnlp file allow the user to access the classes,
and resources obn your server, but only to diownload them and load them lococally oin the client machine
and then in future load an execute them from local machine and run them as, say any local windows applications
with their own windows (not within browser).

As you extened JApplet you don't want to use jnlp.
You want to put soemwhere in the area which is accessible top your web server
the html page which will have the <applet> tag on that page - something like
 <APPLET CODE="Simple.class" archive="classes.jar"
        WIDTH=500 HEIGHT=20>
</APPLET>

Open in new window

and supply the user with the link to this page





           
 
0
 
for_yanCommented:

Why do you want to launch Applet with JNLP?

Applet is nromally laoded from the server  on the html page and executed
in  the browser when you piint to that page

JNLP is for deploymnt of applications.

If you want the users to start applet - you just provide them
with the address of the HTML page which has applet tag in the page
which pioints to classes on the server.
 
0
 
Amitava_MukherjeeAuthor Commented:
for_yan:

thanx for your comment. actually we have some applications as jar file, made by swing or awt. we need to open those from our internal webpage. with some googling i found jnlp is the solution. thats why i am trying to evaluate jnlp and trying to open that from internet explorer
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
for_yanCommented:
In general, you can load applets wiith JNLP, but it is much more common to deploy Applets with Applet tag as I mentioned above
and to use JNLP if you deploy applicatiocations.
0
 
for_yanCommented:
These are the deatils about using the Applet tag:
http://www.iam.ubc.ca/guides/javatut99/applet/appletsonly/html.html
0
 
Amitava_MukherjeeAuthor Commented:
for_yan:

thanx for your comment. though it is irrelevant but may i ask you, why jnlp is used?
0
 
for_yanCommented:
Frankly, if you are asking me why it is used for applets - frankly I don't know.
Applets are much more convenient to bring on the web page.

Applications are different - they are usually siginificantly bigger and you want to load them from local drive.
So Java web start  (JNLP) is used as convenient installer of java applications which allows the user to
easily (without direct involevemnt of the user) download the classes from the server deploy them
on local machine and use in fiuture from local machine and also be able to check if the new version
beacme avaialble on the server.
So JNLP is a conveniyent way of delivery of bifg java applications to the uisers.
0
 
Amitava_MukherjeeAuthor Commented:
thanx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.