September 24th, 1999, 03:57 AM
I am using jdk1.3 ,
I have written a program which calls a file :=
the program looks like this
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;
public class testing extends Applet
{
String str;
String file;
public void init()
{
file = getParameter("FileName");
try
{
FileInputStream fileIn = new FileInputStream(file);
int inBytes = fileIn.available();
byte inBuf[] = new byte[inBytes];
int bytes = fileIn.read(inBuf,0,inBytes);
str = new String(inBuf,0,bytes,"Default");
}
catch(Exception e)
{
String err = e.toString();
System.out.println(err);
str = new String("");
}
}
public void paint(Graphics g)
{
g.drawString(str,0,50);
}
}
The html file is
<applet code ="testing.class" width=300 height=300>
<param name=FileName value="d:\sz\temp.txt">
</applet>
every thing works fine for console based application but the problem is ,if i load the file on the server
for ex WinNt server and reference the file with
<param name=FileName value="http://ntserver/Inetpub/wwwroot/sz/temp.txt">
it is not loaded.
Netscape writes the below in JavaConsole message
netscape.security.AppletSecurityException: security.checkread: Read of '\\Ntserver\InetPub\wwwroot\sz\temp.txt' not permitted
I jhave loaded all the required files on the server.
can any one please guide me the right way;
Thanks
sachin
I have written a program which calls a file :=
the program looks like this
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;
public class testing extends Applet
{
String str;
String file;
public void init()
{
file = getParameter("FileName");
try
{
FileInputStream fileIn = new FileInputStream(file);
int inBytes = fileIn.available();
byte inBuf[] = new byte[inBytes];
int bytes = fileIn.read(inBuf,0,inBytes);
str = new String(inBuf,0,bytes,"Default");
}
catch(Exception e)
{
String err = e.toString();
System.out.println(err);
str = new String("");
}
}
public void paint(Graphics g)
{
g.drawString(str,0,50);
}
}
The html file is
<applet code ="testing.class" width=300 height=300>
<param name=FileName value="d:\sz\temp.txt">
</applet>
every thing works fine for console based application but the problem is ,if i load the file on the server
for ex WinNt server and reference the file with
<param name=FileName value="http://ntserver/Inetpub/wwwroot/sz/temp.txt">
it is not loaded.
Netscape writes the below in JavaConsole message
netscape.security.AppletSecurityException: security.checkread: Read of '\\Ntserver\InetPub\wwwroot\sz\temp.txt' not permitted
I jhave loaded all the required files on the server.
can any one please guide me the right way;
Thanks
sachin