• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

run applet in browser

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one please tell me how to run applet in browser.

I followed the steps from http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html

When i run appletviewer -J-Djava.security.policy=Write.jp http://aURL.com/SignedApplet.html
it showed error - I/O exception while reading: Server returned HTTP response code: 403 for URL: http://aURL.com/SignedApplet.html.

So i gave -J-Djava.security.policy=Write.jp http://localhost:8080/SignedApplet.html and it showed error I/O exception while reading: http://localhost:8080/SignedApplet.html

Can anyone help me out to solve this?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our Applets forum.
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Are you closing applet tag like as following in your html document

<applet code="<your applet class" height="200" width="200" />

End the tag with </applet>.Perhaps it will work.

Regards,
Arka
 
Nisha Kala
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my html code
<applet code="SignedAppletDemo.class"
archive="SSignedApplet.jar"
width=400 height=400>
<param name=file value="/etc/inet/hosts">
</applet>

I closed with </applet> only
 
Nisha Kala
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Its working if i give
appletviewer -J-Djava.security.policy=WriteFile.policy file:///home/pearlin/applet/SignedApplet.html

What should i do if i want it to run in localhost

 
Ranch Hand
Posts: 77
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
  • Solve that 403 from the server first. Nothing the applet itself does, can sort that.
  • It seems strange that this applet is in a Jar called SSignedApplet.jar (should that be a single 'S'?), yet you are messing with policy files. Policy files are no good for anything but development. Forget them. If the Jar is signed, the policy file is redundant, you should be seeing a prompt to trust it. If it is not signed, sign it.
  • Note also that sand-boxed applets can access the local file system using new functionality introduced to applets in Java 1.6.0_10.

  • Why is this an applet rather than an app. launched using Java Web Start?
     
    Ranch Hand
    Posts: 50
    Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Note also that sand-boxed applets can access the local file system using new functionality introduced to applets in Java 1.6.0_10.



    Really??? How is it possible in Java 1.6?
    I have been thinking that accessing local file system is always restricted so we must sign or add permission to the applet.
     
    Andrew Thompson
    Ranch Hand
    Posts: 77
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Nam Ha wrote:

    Note also that sand-boxed applets can access the local file system using new functionality introduced to applets in Java 1.6.0_10.



    Really??? How is it possible in Java 1.6?
    I have been thinking that accessing local file system is always restricted so we must sign or add permission to the applet.



    You have not kept up with the times.

    See the last two links under the 'See also' section of this applet info. page. For a demo of the abilities for accessing the local file system (in a sand-boxed app.), see the File Service demo..
     
    Nam Ha
    Ranch Hand
    Posts: 50
    Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Andrew,

    I think you are confusing between Applets (they are embedded in web browsers) and Java Web Start JNLP (java programs that are downloaded on client computers and being executed as normal java programs).

    Here is some statements from http://download.oracle.com/javase/tutorial/deployment/applet/security.html:


    Unsigned applets cannot perform the following operations:

    They cannot access client resources such as the local filesystem, executable files, system clipboard, and printers.
    They cannot connect to or retrieve resources from any third party server (any server other than the server it originated from).
    They cannot load native libraries.
    They cannot change the SecurityManager.
    They cannot create a ClassLoader.
    They cannot read certain system properties. See System Properties for a list of forbidden system properties.



    and:

    Signed applets do not have the security restrictions that are imposed on unsigned applets and can run outside the security sandbox.

     
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Nam Ha wrote:

    Note also that sand-boxed applets can access the local file system using new functionality introduced to applets in Java 1.6.0_10.


    Really??? How is it possible in Java 1.6?
    I have been thinking that accessing local file system is always restricted so we must sign or add permission to the applet.


    While signing or changing permissions is not required for JNLP, the user must still consent to the action explicitly. So the principle still holds, even if the technicalities have changed.
     
    Andrew Thompson
    Ranch Hand
    Posts: 77
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Nam Ha wrote:..I think you are confusing between Applets (they are embedded in web browsers) and Java Web Start JNLP (java programs that are downloaded on client computers and being executed as normal java programs). ...


    I think you are wasting your time, my patience, and the OP's bandwidth.

    Here are 3 projects.
  • A conventional embedded applet.
  • A conventional JWS free-floating app.
  • An embedded applet configured using JWS.

  • The last is the one that is a sand-boxed applet, but still can open local files. (And yes, I developed all 3, so I have no confusion about the distinctions between them.)

    The knowledge to not make silly statements like the one you did, was contained in the links in my earlier post that you apparently ignored or misunderstood (and I also wrote the blurb to which I linked). I suggest you make sure you understand them, before making further comments on related matters.
     
    Andrew Thompson
    Ranch Hand
    Posts: 77
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Ulf Dittmer wrote:
    While signing or changing permissions is not required for JNLP, the user must still consent to the action explicitly. So the principle still holds, even if the technicalities have changed.



    The user experience is quite different.

  • The old way demanded 'all or nothing' permissions before the applet ever appeared. If refused, it was hard to get another sight of the dialog that prompted us to allow it.
  • The new way asks permission only when the user goes to use that functionality, and only for that functionality. So the user selects the `Open File` menu item, and sees a warning to the effect 'The app. has requested read/write permission for local files'. Since the user selected the menu item, this prompt is much easier to understand, and more likely to be approved. Further, they can refuse it as many times as they like, and still produce another prompt by selecting 'Open File' again.
  •  
    Nam Ha
    Ranch Hand
    Posts: 50
    Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Andrew and Ulf,

    Thank you very much for your information. I learned a new thing
    reply
      Bookmark Topic Watch Topic
    • New Topic