Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

what is ForbiddenTargetException?

 
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
 
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
 
Evacuate the building! Here, take this tiny ad with you:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic