Help -- writing file problem -- Help

hi i have an applet, and i am trying to get it to write to a file but get a file permission exception:
i tried to set the permission with the help of the API but it didnt help.
Help pls
here is code to write to the file
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
public class Add extends Applet1 implements Serializable {
     public Add(JTextArea jTextArea2){
          String newline = System.getProperty("line.separator");
          String NULL = "";
          BufferedWriter outStream;
          StringBuffer buf;
     try {     
          // Set the File Permission
          FilePermission fperm = new FilePermission("*" , "write");
          String inputValue1 = JOptionPane.showInputDialog("Please enter the English Translation");
                 //if(!inputValue1.equals(NULL)) {
                    String inputValue2 = JOptionPane.showInputDialog("Please enter the French Translation");
          String in = (inputValue1 + ":" + inputValue2 + ":" + newline);
          jTextArea2.append(inputValue1 + ":" + inputValue2 + ":" + newline);
          System.out.println(inputValue1 + ":" + inputValue2 + ":" + newline);
          JOptionPane.showMessageDialog(null, in, "alert", JOptionPane.INFORMATION_MESSAGE);
          jTextArea2.append(newline + "getAcrion: " + fperm.getActions() + newline);
          jTextArea2.append(newline + "implies: " + fperm.implies(fperm) + newline);
          String si = in.toString();
          byte[] buff = si.getBytes();
          FileOutputStream out= new FileOutputStream("userDefined.txt", true);
          int j=si.length();
            out.write(buff, 0, j);
          jTextArea2.append(newline + "getAcrion: " + fperm.getActions() + newline);
          jTextArea2.append(newline + "implies: " + fperm.implies(fperm) + newline);
     catch (IOException ev)
          jTextArea2.append("Receivedl Exception: " + ev + newline);
          System.out.println("Receivedl Exception: " + ev + newline);
     catch (java.security.AccessControlException ev)
          jTextArea2.append("Receivedl Exception: " + ev + newline + ev.getMessage());
          System.out.println("Receivedl Exception: " + ev + newline + ev.getMessage());
}here is how i access it from the main applet
public void jButton2_mousePressed(MouseEvent e) {
   Add add1 = new Add(jTextArea2);
  }any help welcomed

An applet is not allowed to write files.
But you can use a signed applet.

Similar Messages

  • Help: .psd file problem

    Hello,
    I am currently trying to solve an issue I'm having currently with Cs5 in opening a canvas I was working on last night.
    Today I tried to open the canvas and found my layers were completely gone. The only layer visable is the background
    layer and it is solid black, with a strange red bar at the top.
    I am not sure how to solve this problem, any help would be very helpful.
    Thanks in advance!
    -Matt

    There seems to be several users with similar problems with psd saves.  By any chance are you using CS5.5?
    For now my advice would be to save psd in mulltiple stages, and as tiff also.  Increases your odds of having a good file.

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • Refreshing Helper Class Files? HELP!

    Hi -
              I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
              Thanks,
              Robert
              Software Engineer
              Carescience, Inc.
              

    In WebLogic 6.x you can hot-redeploy your web-app after you recompile classes in
              WEB-INF/classes.
              Also, for development convinience, you can look at using Resin (http://www.caucho.com) -
              it has an option to automatically compile .java files in WEB-INF/classes and it detects
              any changes to .java files (similar to how JSP works), and recompiles modified source
              files and redeploys web-app if nesessary.
              ROBERT BOND <[email protected]> wrote:
              > Hi -
              > I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
              > Thanks,
              > Robert
              > Software Engineer
              > Carescience, Inc.
              Dimitri
              

  • Huge Flash File Problem HELP!

    Hi,
    I am making a flash animation with imports from illustrator,
    using copy and paste mainly, the resolution of the animation is
    1280 x 1024. The fla file has crawled to 110MB and is seriously
    killing my computer when i trya nd work on it. It takes 25 minutes
    to save! I need the final animation to run full screen a t that
    resolution. Should I be making it at that resolution
    is this the problem?
    please help
    thanks
    apples

    AI artwork can often be flattened in flash by selecting all
    and using Ctrl + B (break apart) until
    it's all 1 layer of vector data as opposed to several grouped
    objects.
    --> Adobe Certified Expert *ACE*
    --> www.mudbubble.com
    --> www.keyframer.com
    feedmeapples wrote:
    > Hi,
    >
    > I am making a flash animation with imports from
    illustrator, using copy and
    > paste mainly, the resolution of the animation is 1280 x
    1024. The fla file has
    > crawled to 110MB and is seriously killing my computer
    when i trya nd work on
    > it. It takes 25 minutes to save! I need the final
    animation to run full screen
    > a t that resolution. Should I be making it at that
    resolution
    >
    > is this the problem?
    >
    > please help
    >
    > thanks
    >
    > apples
    >
    >
    >

  • Linked excel file problem - Help needed

    I have 2 excel files in the same directory in Content Services. The "destination" file has a link in one of its cells to a cell in the "source" file. I want to be able to open the "destination" file and update the data if any changes have been made to the "source" file.
    My problem is when I try to do this i get an error that says "This workbook contains one or more links that cannot be updated" and two options.
    1) To change the source of links, or attempt to update values again, click Edit Links.
    2) To open the workbook as is, click Continue.
    If I click Edit Links I am then presented with a screen where I can open the "source" file. When I try to do this though I am given a login screen. Supplying a valid Content Services username and password doesn't work and I cannot open the file.
    Can anyone tell me how I can open the "destination" file without having to open every "source" file? I don't want to open the "source" files because there could be dozens of "source" files for one "destination" file.

    setw is the equivalent of the field width value in printf. In your code, the printf version would look like:
    printf("%8s", CURSOR->name.c_str());
    I much prefer printf over any I/O formatting in C++. See the printf man page for more information. I recommend using Bwana: http://www.bruji.com/bwana/
    I do think it is a good idea to verify your code on the platform it will be tested against. That means Visual Studio. However, you don't want to use Visual Studio. As you have found out, it gets people into too many bad habits. Linux is much the same way. Both development platforms are designed to build anything, whether or not it is syntactically correct. Both GNU and Microsoft have a long history of changing the language standards just to suit themselves.
    I don't know what level you are in the class, but I have a few tips for you. I'll phrase them so that they answers are a good exercise for the student
    * Look into const-correctness.
    * You don't need to compare a bool to 1. You can just use bool. Plus, any integer or pointer type has an implicit cast to bool.
    * Don't reuse your CURSOR pointer as a temporary index. Create a new pointer inside the for loop.
    * In C++, a struct is the same thing as a class, with all of its members public by default. You can create constructors and member functions in a struct.
    * Optimize your function arguments. Pass by const reference instead of by copy. You will need to use pass by copy at a later date, but don't worry about that now.
    * Look into initializer lists.
    * In C++ NULL and 0 are always the same.
    * Return the result of an expression instead of true or false. Technically this isn't officially Return Value Optimization, but it is a good habit.
    Of course, get it running first, then make it fancy.

  • CS4 file problem help

    Apologize for the fact that I'm sure the answer is out there somewhere but got kids and not a lot of time.
    Q: I have been given (.mov) files imported into imovie on a drive but I have CS4 for PC and can't import. Is there a solution for this? The person is in a remote location in Indonesia so getting to them is very difficult.

    There may be, but so very much will depend on what is inside those MOV files. That MOV is just a wrapper, and can contain a lot of different "stuff." Most of it can be edited on a PC, but some is Mac-specific.
    This ARTICLE will give you some background on the concept of "wrappers," and tell you how to find out (G-Spot) what is inside.
    Welcome to the forum,
    Hunt

  • Sign on problems within Elements 10; plus cannot backup writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

    Sign on problems within Elements 10; plus cannot backup, writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

    Sign on problems within Elements 10; plus cannot backup, writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

  • I'm getting this problem when trying to update my iphone 3gs it says that the iphone software could not be contacted and I went on youtube got some advise to go into my hard drive to fix the error I have nothing in my host file please help me if you can

    I'm getting this problem when trying to update my iphone 3gs it says that the iphone software could not be contacted and I went on youtube got some advise to go into my hard drive to fix the error I have nothing in my host file please help me if you can this is all new to me.

    Read this: iOS 4: Updating your device to iOS 5 or later
    ... oh I think it is a 3gs or a 3
    This makes a difference. What does it say in Settings > General > About?

  • How do I copy files onto a hard drive (device) from Mac 2 7 pc. I'm able to transfer files from device but cannot transfer files to device. Anyone had same problem or can help solve this problem? Help pls

    how do I copy files onto a hard drive (device) from Mac 2 7 pc. I'm able to transfer files from device but cannot transfer files to device. Anyone had same problem or can help solve this problem? Help pls

    Welcome to Apple Support Communities
    When you try to copy data to the external drive, what happens? If you don't see any error, the external drive is formatted in NTFS, and OS X can't write in it.
    To be able to write on this external drive, you have to use an app like Paragon NTFS. Another solution would be to format the external drive in FAT32 or exFAT with Disk Utility > http://pondini.org/OSX/DU1.html Make sure you copied all the files of the external disk to the internal disk before doing it

  • Adobe encore the software that's used to decode the media is not available on this system. installing the correct decoders for the file you are working with may help correct the problem

    Hi,
      I got this message after importing about ten or so H.264 files that I encoded from Adobe media encoder.  "adobe encore the software that's used to decode the media is not available on this system. installing the correct decoders for the file you are working with may help correct the problem."
    The files we're shot with HD cameras.  Edited in Premiere Pro CS3.  I installed the update 3.0.1 with still the same error.
    I also tried a brand new project and after about ten or so files being imported into a timeline, the system crash.  I tried this twice....
        Thanks in Advance

    Hi Hunt,
           Here is the skinny.  A window base PC.  footage shot with HD sony HD cameras,  Project imported to Premiere CS3.  Once completed sent file to Adobe media encoder and render them as H.264 widescreen high Quality.  Imported them to Adobe Encore CS3.  After about ten files or so.  I got the error message.  Did all the basic trouble shoot like restarting the computer, got latest patch.  Even build a new test project with the same problem.
        Something else I read in the forums, is the encore will transcoded the project to Mpeg 2 anyway, after looking at my project I realized those few files were indeed untranscoded.  So it will be a double compression and I dont want that.  So, my new question is, what is H.264 good for ?????????? I was research that Mpeg 2 is a faster render but H.264 is a slower render but better quality.....
       what do you think ????
       Peter

  • I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

  • When trying to install Aid Virtual Instruments I get a warning no mountable file systems. I need help fixing the problem.

    When trying to install Pro Tools 10.3.3 Aid Virtual Instruments I get a warning no mountable file systems. I need help fixing the problem.

    Thanks Linc for responding to my post. I searched a little further and found I was missing a file. Once I downloaded the fix, I was able to install the software from the original download.

  • You cannot embed this FLV file because it consumes too much memory. Could sb help with this problem?

    You cannot embed this FLV file because it consumes too much memory. Could sb help with this problem?

    The error is pretty concise. Do you know how to re-encode the video smaller?

  • Need help writing to file

    I have an ArrayList of XML strings. I am trying to write the XML strings in the arraylist to a text file. However, the only XML string that I see in the file is the first string repeated over and over. It is the only one getting to the file for some reason. I have tried the code below:
        public void writeToLogFile(String logFile, String msg) {
                try{   
                    FileWriter WriteFile = new FileWriter(logFile, true);  
                    BufferedWriter WriteBuff = new BufferedWriter(WriteFile); 
                    WriteBuff.write(msg+"\r\n");
                    WriteBuff.close(); 
                    WriteFile.close(); 
                }catch(IOException e) {
                    System.out.println("Error writing to file.");
    //        try {
    //            FileWriter fw = new FileWriter(logFile,true);
    //            PrintWriter pw = new PrintWriter(fw);
    //            pw.println(msg);
    //            pw.close();
    //        }catch(IOException ioExc) {
    //            System.out.println("error writing file");
        }  I tried the commented out code also. I've also tried using PrintStream. They all seem to give me the same result. My first thought was maybe I'm sending the same string to the method over and over but I'm not. If I loop through my arraylist of XML strings and do a System.out.println() instead of writing to file, I see that I am sending in different XML strings.
    Here's how I'm looping through the arraylist of XML strings call "al":
                for(int i=0; i<FileValues.length; i++) {
                    al = adapter.executeQuery(FileValues[0]);
    System.out.println("Writing to output file...");
    for(int x=0; x<=al.size()-1; x++) {
    //System.out.println(al.get(x).toString());
    test.writeToLogFile("c:/temp/a/limAdapterOutput", al.get(i).toString());
    System.out.println("Finished writing to output file.");
    What I'm doing is reading an arraylist (FileValues) of query parameters. For each parameter, I am querying a database based on the parameter and returning an arraylist of XML strings containing the query result. For each paramter, I'm returning about 1200 XML strings in the arraylist. Then I try to loop through the arraylist and write the XML strings to a file. However, this is when I run into my problem.
    Any ideas what's going on and how I can correct the problem? Thanks.

    for(int i=0; i<FileValues.length; i++) {
    al =
    al =
    al = adapter.executeQuery(FileValues[0]);
    System.out.println("Writing to output
    iting to output file...");
    for(int x=0; x<=al.size()-1; x++) {
    //System.out.println(al.get(x).toString());
    test.writeToLogFile("c:/temp/a/limAdapterOutput",
    ut", al.get(i).toString());
    System.out.println("Finished writing
    inished writing to output file.");
    When you write to the log file in the inner loop, it sounds like you want to use the x loop counter, not the i counter from the outer loop.  You comment out the print to System.out, which uses the x loop counter.  Why don't you do the same thing in the uncommented code?  Hard to follow exactly what you're doing, but maybe that will fix it.

Maybe you are looking for