• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

getClass.getResourceAsStream returns null if run locally.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getClass.getResourceAsStream returns null if run locally.

I have two applets. Once the first applet is started, it makes a javascript call to launch the second applet. The second applet passes itself via javascript to the first applet. Everything works fine up to this point. Now when I try to call getClass().getResourceAsStream() from the second applet it returns null. But not with every plugin. Testing produced the following results:

1.3.1_09 - worked
1.4.0 - failed
1.4.0_02 - failed
1.4.0_03 - worked
1.4.0_04 - worked
1.4.1 - worked
1.4.1_02 - worked
1.4.1_03 - worked
1.4.2 - worked
1.4.2_01 - failed
1.4.2_02 - failed
1.4.2_03 - failed
1.4.2_04 - failed
1.5 beta - failed

Here is the code for the first applet:


And here is the code for the second applet:



Here is the javascript code loadertest.js:



runtime.jar consists of the Start applet class
resourceloader.jar consists of ResourceApplet.class and an empty ResourceAppletBeanInfo.class
resources.jar consists of one text file resource.txt which contains a success message to show in the first
applet if we are successful.

If anyone can shed some light on this problem it would be most appreciated. What change from one
minor version of plugin to another may have caused it to work in one plugin and not the other?
Why does it work when served from an IIS or Apache web server but not when run locally?
Any help?
 
Diane Loux
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried creating a policy file but the only
thing that succeeded was giving all permissions to any codebase, which
is not a viable solution. Anyone?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!