Solved

UniversalFileWrite Error

Posted on 1998-01-14
2
220 Views
Last Modified: 2008-02-01
I am running jdk1.1 on a NN(4.04) Browser.  I am trying to write a file out on the server dynamically within my java applet.  I am using the fileoutputstream and dataoutputstream utilities.  The code is as follows:

private FileOutputStream fout;
private DataOutputStream ostream;
public htmlObj(String title)
{
  try
  {
     fout = new                                         FileOutputStream("http://bds867/trs/"+title+".html");
      ostream = new DataOutputStream(fout);
  }catch(Exception e)
  {
      System.out.println("Error " + e);
  }

}

And the error I keep getting is:

# Security Exception:
checkwrite:http://bds867/trs/TEST_HTML_FILE.html
Error netscape.security.AppletSecurityException: security.checkwrite:
http://bds867/trs/TEST_HTML_FILE.html
#  UniversalFileWrite privilege not enabled: Modifying files stored in your computer

I think it means that I'm trying to write something on the client.  But I'm not.  Can anybody help me???


Joanna
0
Comment
Question by:jcora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
bogamo earned 40 total points
ID: 1232206
As far as Java is concerned here, you are trying to write to a file called http://.... on the client machine...

I'm not sure you can write to a URL like that at all, however, you can easily read a URL.  The following code snippet should show you how to read a URL.


try {
     URL u = new URL("http://someserver/whatever.html");
} catch (MalformedURLException e){System.out.println("Error");}

InputStream is = u.openStream();

 then play with the inputstream all you want.

If you need to write something to the server, there are two decent methods which I have used in the past.  My preferred option is to have a java Application running on the server machine listening at a specified port.  Have the java application take care of writing the file.

The second and probably more standard approach would be to write a CGI script on the server, then post the content to this script.

Either option will require the use of Sockets......

Hope this helps,

-Geoff


0
 

Author Comment

by:jcora
ID: 1232207
To tell you the truth, what I'm trying to do is print out the contents of a grid component and the only way I can see of doing that is by writing an html file with the table holding the contents, having the client read that html file, and then have the client print it with the utility provided on the browser.  Do you have any other sugestions?

Joanna
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question