Link to home
Start Free TrialLog in
Avatar of Narayanaswamy
Narayanaswamy

asked on

Applet data to TextFile

Hai
  I am having an Applet.

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

public class FileTest extends Applet {

  public void paint(Graphics g) {
    String fileName = "MyTest.txt";
    try {
      FileOutputStream fos = new FileOutputStream(fileName);
      PrintStream outputFile = new PrintStream(fos);
      outputFile.println(" This is a test");
      outputFile.close();
      fos.close();
      g.drawString("The applet created the file " + fileName, 10, 20);
    }
    catch (Exception e) {
      g.drawString(e + "", 10, 20);
    }
  } // paint

}


If I execute this It shows error: access denied  java.FilePermission .....
How to send the output to txt file from Applet?

I want to save the Applet and Txt file in server and  clients want to write the information to the txt file through the Applet.
Is it possible ? If so How?

Thanks
Narayanaswamy
Avatar of Narayanaswamy
Narayanaswamy

ASKER

Can any one give me sample codes or links

Narayanaswamy
Avatar of Mick Barry
you need to sign your applet

And you shouldn't do the file writing in paint, this will get called every time the applet requires repainting.
Thanks objects

I am not aware of "you need to sign your applet"

Can i get more details and any sample codes


Narayanaswamy
Hai
I read that article.

I did the Signed Applet using JDK Plugin

It is working in my system. ( It is creating the txt file in desktop not in the same folder where the class file resides ) and also When I tried from another system this is not working....

When I try Signed Applet in Internet Explorer
makecert is not accepted by the command line

Can you help me in doing this....

Narayanaswamy
Hai

I placed the jar file and the html file in the Server.

I opened the Url..
The txt file is created in my system but i want that to be created in the server....

How to to that..?

Thanks
Narayanaswamy
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can I get more details about that please.....

Narayanaswamy
Hai
May i know from where I can download the Microsoft SDK for Java
and how to install and include in my class path to sign my applet...

Thanks
Narayanaswamy
> where I can download the Microsoft SDK for Java

i don't believe it is available anymore.
Then can you explain me
how to sign in  the applet to the system that doesn't have JDK plugin...?

When i tried to start My applet in the system that doesnt have JDK plugin but  Microsoft JVM is present I am not able to see the applet insted i can able to see only a blank space...

How to load my applet into that system.

Thanks
Narayanaswamy
Unfortunately I don't think you can.
Try searching the web for the tools required.