4

I'm trying to run my JNLP within an HTML page, but the java plugin does not run the JNLP, runs only the Applet.

Here is my code:

<applet width="800" height="500" codebase="http://127.0.0.1:8888/applets/"
    code="br.com.app.server.utils.CompatibilityApplet"
    archive="CompatibilityApplet.jar">
            <param name="jnlp_ref" value="http://127.0.0.1:8888/applets/testehellojws.jnlp">
</applet>

Thanks.

[EDIT]

An example:

http://java.sun.com/javase/ja/6/ea/6u10/plugin2/jnlp/CompatibilityApplet.java

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="6.0+" codebase="http://127.0.0.1:8888/applets/" href="testehellojws.jnlp">
    <information>
        <title>App Hello</title>
        <vendor>My App Jnlp.</vendor>
        <homepage href="http://127.0.0.1:8888/Home.html"/>
        <description>My App Jnlp</description>
        <description kind="short">Appr</description>
        <icon href="images/icone.jpg"/>
    </information>
    <resources>
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="hello.jar" main="true"/>
    </resources>
    <application-desc main-class="br.com.app.server.HelloJWS"></application-desc>
</jnlp>

Please edit your question and just let me know it is edited.

OK

Did you miss the part about the documentBase?

I didn't.

I would recommend removing the space in the applet name attribute.

Done

Can you run any other JNLP embedded applets? E.G. the small (sand-boxed) GIFanim applet at my site?

Yes

What info. do you get reported from here?

java.vendor: Sun Microsystems Inc.
java.version: 1.6.0_26
os.name: Windows 7
os.version: 6.1

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
caarlos0
  • 20,020
  • 27
  • 85
  • 160

4 Answers4

2
<application-desc main-class="br.com.app.server.HelloJWS"></application-desc>

That is the descriptor for a Java application (as opposed to an applet). For an applet, use something more like..

<applet-desc main-class="br.com.app.server.HelloJWS"></applet-desc>

Note:

  1. Even that is not a correct descriptor for an applet, which must explicitly state a documentBase, name, width & height. See the applet-desc section of the JNLP File Syntax for more details.
  2. It must (of course) be an applet. It is not possible to 'embed' an application into a web page using this technique.
  3. JNLP and the Java Plug-In (required for both applets and web start) was deprecated and removed from the API in Java 9.
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
1

Your jnlp_ref should probably be an absolute URI, e.g. http://127.0.0.1:8888/applets/testehellojws.jnlp

Also there is a stray space at the start of your code value (though this is probably not the cause of your problem.)

finnw
  • 47,861
  • 24
  • 143
  • 221
1

Checking on a related post, I decided to test the tag

<OBJECT>

. I thought that this would not work with JNLP, so we had tested before. After changing

<APPLET> 

to

<OBJECT> 

and referencing my jnlp file as a parameter, it worked! The browser ignores the code and archive parameters and run my JNLP.

thanks.

caarlos0
  • 20,020
  • 27
  • 85
  • 160
  • I added a comment (now deleted) before noticing this answer. It makes me more sure that it was a caching problem. Changing it to the `object` element probably fooled the JRE into thinking it had to download it fresh. But don't settle for that, use [deployJava.js](http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html) to write the correct applet (/object/embed ..whatever) element. – Andrew Thompson Sep 06 '11 at 13:52
  • I will try it. I don't know if it's possible to use it with GWT. Thanks dude. – caarlos0 Sep 06 '11 at 13:55
-1

Try to remove [archive="CompatibilityApplet.jar"]

RickeyShao
  • 65
  • 1
  • 1
  • 7