reading files on a network drive

E

elsanto

Hi,

I wrote the following program for reading files from a jsp page on my
local drive, now when I try to read a file on a mapped drive, the
mydirectory.exists() returns false.

File mydirectory = new File("PathOnTheNetwork");

Is using a signed applet the only solution?

Thanks

Elsanto
 
A

Alan Krueger

I wrote the following program for reading files from a jsp page on my
local drive, now when I try to read a file on a mapped drive, the
mydirectory.exists() returns false.

File mydirectory = new File("PathOnTheNetwork");

Is using a signed applet the only solution?

Your first sentence suggests that you're reading server-side files. The
last sentence suggests that you're reading client-side files. Which is it?

If it's the latter, then it has nothing to do with what kind of drive or
folder you're trying to access.

"In Java-enabled browsers, untrusted applets cannot read
or write files at all."
- http://java.sun.com/sfaq/#read
 
R

Roedy Green

A

Andrew Thompson

Roedy said:
You could use JAWS, an applet, a signed Applet, but an unsigned Applet
cannot read the local file system.

Note that *any* JWS applet *or* application would need to be
signed for this. Unsigned applications gain a very 'applet like'
sandbox when deployed using Webstart.

This page consistenly uses the word 'applications', which
might lead a reader to believe that applets *cannot* be deployed
using webstart [..and yes, I also disagree with your 'two words'
comment, (shrugs) Sun apparently changed, it seems that now
'Webstart' or 'WebStart' is prominent..].

Mind you, I have never seen a good term that describes
'Java applications and applets', and an applet might fit
the wider meaning of the term 'application'.

Could you change the page to point out that JWS *can* also
be used with applets? [ You might also mention that as soon
as developers see what applets lose when deployed by JWS
(resizeable window, interaction with other applets or JS..),
they will quickly abandon it in disgust, but that is
another matter. ]
 
E

elsanto

Sorry for the confusion. I'm trying to read client side files
and thanks again for the reply

elsanto
 
R

Roedy Green

Could you change the page to point out that JWS *can* also
be used with applets?

I have never seen a JAWS Applet and I can't see how they could be
deployed. I could see what I call a hybrid, but not something without
a main method. Applets are controlled by having their init, start,
stop and destroy methods called for them. They run inside html in web
pages. None of this has anything to do with JAWS.

Are you just talking about using JAWS to deliver a local jar
containing an Applet? but even then the jar has no easy to find
address a webpage could use.

Where did you hear about this?
 
A

Andrew Thompson

Roedy said:
I have never seen a JAWS Applet and I can't see how they could be
deployed.

If a picture paints a thousand words, how many
does a demo paint?
<http://www.physci.org/codes/jws/demo.jsp>

[ Hopefully this page stands as it is for someone that
has not read this thread, if there is anything in the
page that is not 'inuitively obvious', please let me know. ]
 
R

Roedy Green

If a picture paints a thousand words, how many
does a demo paint?
<http://www.physci.org/codes/jws/demo.jsp>

the interesting thing was this in the JNLP file:

<applet-desc
documentBase="http://www.physci.org/pc/property.jsp"
name="propertiesapplet"
main-class="PropertiesApplet"
width="500"
height="400">
<applet-desc>

So JAWS is not just treating it as an application. I noticed this
Applet runs outside a browser.

When did that tag come in?

Have you checked to see just how clever the appletviewer is? Does it
know how to deal with showDocument?
 
A

Andrew Thompson

Roedy said:
On Wed, 12 Oct 2005 01:43:02 GMT, Andrew Thompson


the interesting thing was this in the JNLP file:

<applet-desc ....
So JAWS is not just treating it as an application. I noticed this
Applet runs outside a browser.

Yep. That (in my arrogant opinion) is what then
makes it all rather silly. Applets can gain some
advantages over applications by leveraging the power
of the browser itself (whichever browser it is).

JWS applets lose that.
When did that tag come in?

I have seen it in the 1.4 JWS docs, not sure about earlier..
Have you checked to see just how clever the appletviewer is?

Yep. (and, like you seem to be, I am assuming the
AppletViewer is used for JWS applets.)
..Does it know how to deal with showDocument?

Nope. showDocument() is ignored silently by the AppletViewer.
[ Or at least, it did when I checked it last year - I
was developing an applet viewer where I use BrowserLauncher
to emulate 'showDocument' - kludgily - ignoring named windows. ]

But then, that is 'allowable' according tho the JavaDocs, as the
(non-browser) applet container is free to ignore 'showDocument()'.
<http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AppletContext.html#showDocument(java.net.URL)>
"This method may be ignored by applet contexts that are not browsers."

Experience has shown that showDocument() is now being
ignored/suppressed by any variety of pop-up blockers
or browser upgrade patches. The only reliable way to
get something to appear 'over' an applet is to
a) put the content inside a Java (J)Window/(J)Frame/(J)Dialog.
b) sign the applet and use 'BrowserLauncher' to get
a new browser window.
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top