This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JApplet in browser (IE)

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've a JApplet that runs fine in appletviewer.
I used HTML converter to convert HTML applet tag into object tag result:
<html>
<body>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 250 HEIGHT = 150 codebase="http://java.sun.com/products/plugin/1.1.1/jinstall-111-win32.cab#Version=1,1,1,0">;
<PARAM NAME = CODE VALUE = "JLabelDemo.class" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.1" java_CODE = "JLabelDemo.class" WIDTH = 250 HEIGHT = 150 pluginspage="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"><NOEMBED></COMMENT>;
</NOEMBED></EMBED>
</OBJECT>
<!--
<APPLET CODE = "JLabelDemo.class" WIDTH = 250 HEIGHT = 150 >

</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</body>
</html>
And I've java plug-in 1.3.1_02 which came with jre. I've followed all instructions for setup.
When I run converted html file in IE 5.5 I get
"applet not initialized" in status bar and the following error in Java console:
java.security.AccessControlException: access denied (java.io.FilePermission france.gif read) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at sun.awt.SunToolkit.getImageFromHash(Unknown Source) at sun.awt.SunToolkit.getImage(Unknown Source) at javax.swing.ImageIcon.<init>(Unknown Source) at javax.swing.ImageIcon.<init>(Unknown Source) at JLabelDemo.init(JLabelDemo.java:15) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
what can I do ? ???
[ March 10, 2002: Message edited by: Vishakha Ahuja ]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vishakha,
Applets are not allowed to read from the local file system. You will need to sign your applet in order for the user to give your applet permission to do so. Another alternative is to place the image file onto your server in the same directory where your HTML file is located and get it:
getImage( url );
Regards,
Manfred.
 
Vishakha Ahuja
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manfred,
My applet is actually not reading any local files nor is it loading any images. The HTML file is auto generated by HTML Converter and I do not understand the object,embed tags etc.
Can I make some changes to this HTML file to load the applet without causing permission/security problems ?
[ March 11, 2002: Message edited by: Vishakha Ahuja ]
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vishakha,
The applet is trying to load an image file named:
france.gif
If you are trying to use it as a label icon or something else you could try and remove it and the applet might load.
Regards,
Manfred.
 
Vishakha Ahuja
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, I overlooked it as it was the "image" was a parameter in the constructor.
Anyway what changes can I make to this HTML file to load the applet without causing permission/security problems ?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vishakha,
Applets are not allowed to read from the local file system. You will need to sign your applet in order for the user to give your applet permission to do so. Another alternative is to place the image file onto your server in the same directory where your HTML file is located and get it:
getImage( url );
Regards,
Manfred.
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic