• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is ForbiddenTargetException?

 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I implement an applet-servlet (using socket commu) client-server appl., in which I save a file to local drive in client side.
<code base>
try
{
try
{
PrivilegeManager.enablePrivilege ("UniversalFileAccess");

input = new BufferedReader(new FileReader(sourceFileString));

outputFile = new File(destFileString);
output= new BufferedWriter(new FileWriter(outputFile));

while ((line = input.readLine())!=null) {
output.write(line, 0, line.length());
output.newLine();
output.flush();
}
}
catch (SecurityException e)
{
System.out.println("Read/WriteFile\n: caught SecurityException");
return false;
}
catch (IOException ioe)
{
System.out.println("Read/WriteFile\n: caught IOException");
return false;
}

PrivilegeManager.revertPrivilege ("UniversalFileAccess");

}
catch(ForbiddenTargetException fte)
{
System.out.println("WriteFile\n: caught ForbiddenTargetException");
return false;
}
</code>
It gave me ForbiddenTargetException.
Please help,
Simon
 
Suneel Setlur
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Guess you are using a Netscape browser.
The ForbiddenTargetException is thrown by Netscape. Try including the java40.jar in the classpath. If you are using Netscape 4.7, you will find this file in
\Program Files\Netscape\Communicator\program\java\classes
directory.
Hope it helps.
Suneel
 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, Suneel,
yes, I am using netscape commun4.7
I did copy java40 into jdk\jre\lib\ext. The program works when I use applet-java (socket). but when i shift to applet-servlet. The problem ForbiddenTargetException happens.
Could you guys help me? Thanks
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic