sir
in my web based project i need to read file from directory and display it in applet which in turn displayed in html means applet code is embedded in html .
and this is running through web server
tomcat tell now applet is displaying all components in html next step is to read the file and display it
when i directly display without server by double clicking html it will show file read in applet and displayed in html
then how shell i do it through server can any body guide me its urgent i am not getting
when i try to do this it is showing exception
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump
thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
The Direcory location=null
Full directory path=/localhost:7001/appletcodenull
java.security.AccessControlException: access denied (java.io.FilePermission \localhost:7001\appletcodenull 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 java.io.File.isDirectory(Unknown Source)
at Backup.init(Backup.java:131)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
and my code to read file in applet is this
///============Reading from file==========
questionDir=getParameter("questionDir");
dirName=getCodeBase()+"";
System.out.println(dirName);
dirName=(dirName.substring(0,dirName.length()));
System.out.println(dirName);
dirName=dirName.substring(6,dirName.lastIndexOf('/'));
System.out.println(dirName);
dirName=dirName+questionDir;
System.out.println(dirName);
File f=new File(dirName);
if(f.isDirectory())
{
noOfFiles=f.list();
}
readFile();// it is method calling from init()method
==============================================
public void readFile()
{
String line;
InputStream in;
try
{
fileToRead=dirName+File.separator+"Question"+(countFile+1)+".java";
in = new FileInputStream(fileToRead);
BufferedReader bf = new BufferedReader(new InputStreamReader(in));
strBuff = new StringBuffer();
while((line = bf.readLine()) != null)
{
strBuff.append(line + "\n");
}
questionArea.append(strBuff.toString());
}
catch(IOException e)
{
e.printStackTrace();
}
countFile++;
}
-------------------------------------------------------------------
if any changes are there correct it pl
its urgent
thanks