Applet guidance

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Applet guidance

Leigh McRae
Hi,

I could use a push, not a full hand holding, just an overview to help me get me going.  I'm working on getting my applet to open a TcpSocket connection to a host that is different from the web server that is hosting the applet.  I'm getting a security error and assume I need to sign my applet.

java.security.AccessControlException: access denied (java.net.SocketPermission xx.xx.xx.x:xxxx connect,resolve)

I have managed to get a JOGL applet deployed and render some basic 3D.  At the end of this post is my html and jnlp.  

Questions:

1) Do I need to sign my applet?  I thought I saw somewhere that JOGL could deliver my applet and only have the user accept the JogAmp certificate.

2) If I do need to sign my applet, can I just use my own key store that I create or do I need to go online and have someone register it for me?  

3) I see people using JNLPAppletLauncher.  Why would I need or want to use this?

Thanks for anytime spent.

index.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
        <title>Odin</title>
</head>

 <body>
        <script src="http://www.java.com/js/deployJava.js"></script>    <script> var attributes = { code:'com.lonedwarfgames.odin.browser.OdinBrowser', archive:'odin.jar', width:1024, height:768 } ; var parameters = { jnlp_href: 'odin.jnlp' } ; deployJava.runApplet(attributes, parameters, '1.5'); </script></body>
</html>

odin.jnlp

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" href="odin.jnlp">
    <information>
        <title>Odin</title>
        <vendor>Lone Dwarf Games Inc</vendor>
    </information>

        <resources>
                <j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+"/>
                <property name="sun.java2d.noddraw" value="true"/> 
                <jar href="odin.jar" main="true" />
                <extension name="jogl-all-awt" href="http://jogamp.org/deployment/webstart/jogl-all-awt.jnlp" />
    </resources>

        <applet-desc
         name="Odin"
         main-class="com.lonedwarfgames.odin.browser.OdinBrowser"
         width="1024"
         height="768">
    </applet-desc>
</jnlp>       


Reply | Threaded
Open this post in threaded view
|

Re: Applet guidance

gouessej
Administrator
Hi!

Mixing unsigned and signed JARs is not a good idea since Java 1.6 update 20. Therefore, I advise you to sign your applet. You can use your own keystore as I do for my own first person shooter. However, each JNLP file must directly refer to JARs signed with the same certificate, the other JARs have to be got as extension(s) (as you already do). I don't know JNLPAppletLauncher as I only use Java Web Start without applets, maybe someone else could answer your last question. Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Applet guidance

Leigh McRae
Right.  I signed my jar using my own key and it worked.  Thanks.  

Is there anyway to make it so the user only needs to accept one certificate?  I'm guessing if I sign everything including JOGL and host it all myself. I'm guessing that this isn't preferred as JOGL won't be shared/cached for use with other JOGL apps.

Reply | Threaded
Open this post in threaded view
|

Re: Applet guidance

Wade Walker
Administrator
I've been signing it all myself, for exactly that reason. Right now I don't worry about duplicating JOGL on someone's machine -- it's not that big, and if we're so widely used that many users have more than one copy, I'll be very happy