Java applet file handling on Web

W

WebNovice

I want to create/read/write files using a Java applet on a website.
I've written a trivial applet in Netbeans & it runs OK when tested in
NetBeans. When moved to a different folder on my PC with a .html file
to call it, it gives error "Java.security.AccessControlException:
access denied (java.util.PropertyPermission user.dir read)". The same
problem occurs on a website. I must need to set permissions. But
Where? and How? Thanks
 
A

Andrew Thompson

WebNovice said:
I want to create/read/write files using a Java applet

If using a rich client, why not launch the GUI using web start?
e.g. <http://www.physci.org/jws/#jtest>
If using web start, it might be better to just make it an
application (based on a JFrame).
..on a website.

Uh-huh.
Reading the (publicly accessible) files from the same
web site is no problem.
Creating and writing files on a web site is a whole
different matter. Mostly there are security considerations,
and the *web site* itself must support the file upload
functionality. The upload code on the server might
be written as JSP, Servlet, (PHP, ASP..), but the client
itself cannot take responsibility for writing the files,
the server *must* do that itself.

That is why..
I've written a trivial applet in Netbeans & it runs OK when tested in
NetBeans. When moved to a different folder on my PC with a .html file
to call it, it gives error "Java.security.AccessControlException:

A 'client' such as an applet (or JWS appl.) cannot get
a 'File' on the 'server' - ever.

To access files on the client is a different matter
again. An applet would need to be signed and accepted
by the user with full permissions - even then, there was
suggestion some of the latest IE browser variants
will limit the directories that an applet can read
from/write to.

A JWS app. would *not* need to be signed to access
files off the local file-system. Instead it could use the
extra services available in the JWS (javax.jnlp.*) API,
such as the FileOpenService.
<http://www.physci.org/jws/#fs>
(<http://www.physci.org/jws/filetest-sandbox.jnlp>)

What sort/flavor(/size..) of files are you needing to support?

What does this 'file upload' facility aim to provide to
the end user? (the wider picture, like 'allow them to
create web based sites generated from genealogy
files' or 'enable the user to create image slideshow
sites'.)

--
Andrew Thompson
http://www.physci.org/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
 
W

WebNovice

To Andrew Thompson

Thanks for the detailed reply and web references. On my PC I have a
folder which is an image of the Web site & I hoped to be able to run
the "web site" locally using "open with internet explorer" for testing
and to give clues to problems on the actual site. The necessary
permissions etc sound formidable to implement - I may have to proceed
slowly.

The aim is to use the web site as a post office to run a old play-by-
mail computerised wargame. Turns are processd periodically (eg
weekly) at HQ (my PC). Results are sent to players via .txt files.
Players also must download a Java program as java .class files. This
they run on their PCs to view the latest stae of play & to enter
orders which are periodically sent back to HQ also as .txt files for
validation & processing. There is an e-mail version in which the data
transfer is by zipped e-mail attachments but the interest in this is
underwhelming probably because people are reluctant to reveal e-mail
addresses.

aptly

WebNovice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top