Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

reading files on a network drive

Thread view: 
elsanto@caramail.com - 10 Oct 2005 17:26 GMT
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
Alan Krueger - 11 Oct 2005 01:46 GMT
> 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
[quoted text clipped - 3 lines]
>
> 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
Roedy Green - 11 Oct 2005 02:12 GMT
>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
[quoted text clipped - 3 lines]
>
>Is using a signed applet the only solution?

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

see http://mindprod.com/jgloss/javawebstart.html
http://mindprod.com/jgloss/signedapplets.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Andrew Thompson - 11 Oct 2005 04:18 GMT
>>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.
...
>>Is using a signed applet the only solution?
>
> 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.

> see http://mindprod.com/jgloss/javawebstart.html

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. ]
Roedy Green - 11 Oct 2005 23:18 GMT
>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?

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Andrew Thompson - 12 Oct 2005 02:43 GMT
>>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.

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. ]
Roedy Green - 12 Oct 2005 04:32 GMT
>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?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Andrew Thompson - 12 Oct 2005 04:48 GMT
..
>><http://www.physci.org/codes/jws/demo.jsp>
>
> 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#showDocum
ent(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.
elsanto@caramail.com - 11 Oct 2005 17:55 GMT
Sorry for the confusion. I'm trying to read client side files
and thanks again for the reply

elsanto


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.