jQuery in Action, 3rd edition
The moose likes Applets and the fly likes how to open a file ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "how to open a file ?" Watch "how to open a file ?" New topic

how to open a file ?

Mahesh Bhatt
Ranch Hand

Joined: Sep 15, 2004
Posts: 88
Hi all,
I am building a small application in which i need to open a file by calling another class from my applet.However when i do this, on my java console (if i use intenet explorer) i get an exception about file access denied . Does that mean i cannot open a file without having a server ? please tell me how to get this problem solved.

Impossible is I M Possible
Joe Ess

Joined: Oct 29, 2001
Posts: 9190

An applet cannot ordinarily read or write files on the host that is executing it.
The JDK Applet Viewer actually permits some user-specified exceptions to this rule, but Netscape Navigator 2.0, for example, does not. Applets in any applet viewer can read files specified with full URLs, instead of by a filename. A workaround for not being to write files is to have the applet forward data to an application on the host the applet came from. This application can write the data files on its own host. See Working with a Server-Side Application for more examples.

The Java Tutorial: Applet Security Restrictions

[How To Ask Questions On JavaRanch]
I agree. Here's the link: http://aspose.com/file-tools
subject: how to open a file ?
It's not a secret anymore!