|
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 +---
As an Amazon Associate we earn from qualifying purchases.
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.