× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: File creation Problem
  • From: Nick_Vrtis@xxxxxxxxx
  • Date: Wed, 17 May 2000 17:07:09 -0400


Padmanabhan,

Applets cannot write files, expect to the host that they came back from.
And you have to identify the host exactly the same way that the applet was
loaded from.

Nick




"Padmanabhan R (RBIN/ACF)" <Padmanabhan.R@in.bosch.com>@midrange.com on
05/17/2000 11:29:40 AM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   JAVA400-L@midrange.com
cc:

Subject:  File creation Problem


Hello ,

          I tried to run the following code , but it is throwing out
the security exception.

import java.applet.*;
import java.awt.*;
import java.io.*;

public class SimpleSaver extends Applet
{

     public void init()
     {
          Button b = new Button("Beans Book");
          b.setFont(new Font("System", Font.BOLD, 36));
          add(b);
          Saver f = new Saver(b);

     }


class Saver
{

public Saver(Button b){


     try{

               FileOutputStream f = new
FileOutputStream("Sav.tmp");
               ObjectOutput s = new ObjectOutputStream(f);
               s.writeObject(b);
               s.flush();
               }catch(Exception e)
                {
                    e.printStackTrace();
                    System.out.println(e);
               }


                    }

  }

}

Exception

E:\jdk1.2\bin\appletviewer.exe     SimpleApplet.html
Working Directory - E:\samples\
Class Path - E:\samples\;
;.;d:\Kawa\classes.zip;e:\jdk1.2\lib\tools.jar;e:\jdk1.2\jre\lib\rt.jar;E:
\j
dk1.2\lib\dt.jar;E:\jdk1.2\jre\lib\jaws.jar;E:\jdk1.2\jre\lib\i18n.jar;E:
\jd
k1.2\lib\servlet.jar;E:\jdk1.2\lib\as400Driver.jar;i:
\proddata\http\public\j
t400\utilities\;i:\proddata\http\public\jt400\lib\jt400.jar
java.security.AccessControlException: access denied (java.io.FilePermission
Sav.tmp write)

     at java.security.AccessControlContext.checkPermission(Compiled Code)

     at java.security.AccessController.checkPermission(Compiled Code)

     at java.lang.SecurityManager.checkPermission(Compiled Code)

     at java.lang.SecurityManager.checkWrite(SecurityManager.java:946)

     at java.io.FileOutputStream.<init>(FileOutputStream.java:96)

     at java.io.FileOutputStream.<init>(FileOutputStream.java:62)

     at SimpleSaver$Saver.<init>(SimpleSaver.java:26)

     at SimpleSaver.init(SimpleSaver.java:13)

     at sun.applet.AppletPanel.run(Compiled Code)

     at java.lang.Thread.run(Thread.java:479)

java.security.AccessControlException: access denied (java.io.FilePermission
Sav.tmp write)

Process Exit...
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.