dcsimg
Readin images from codeBase
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Vik_Germash
Posted On:   Wednesday, April 16, 2003 07:49 AM

Hi,

do you know how can i permit my Applet to read a file
placed in the same directory where this Applet is running ?
I thought that i can browse this directory without signing of the Applet.
I only need to read one text File,
so maybe there some easyer way todo it as "signing"?




Thank you Vik.

Re: Readin images from codeBase

Posted By:   Laxman_Subramanian  
Posted On:   Monday, April 21, 2003 12:24 PM

Applet can read the file included in its Jar or the CAB archive . using getResourceAsStream


InputStream is = this.getClass ().getResourceAsStream ( "picture.gif" ) ;

// or
InputStream is = MyClass.class.getResourceAsStream ( "me.ser" ) ;



java.lang.Class.getResourceAsStream lets you read files in jars, or in the directory from which the Applet class files were loaded.

Its not necessary to sign this applet .
for more info try this link.
http://mindprod.com/jglossgetresourceasstream.html

else you can place the file you want to have your applet read on the same webserver as ur applet and make a URL connection and read it in your applet .
About | Sitemap | Contact