Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

how to read files from remote system  RSS feed

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi

i am trying to read fiels from remote system.
i've got all the access and sharing permissionsfor the particular directory on the remote system.

when i try opening the directory form windows run i am able to access the
directory, create new folders and delete folders etc.. but when i am using the same path in program i am not able to access the directory or folders.
i am getting a Nullpointer error.

the code i am using is

----------------
<%@ page language="java" import="java.io.*,java.lang.String,java.util.regex.*,java.io.File,java.util.*,java.util.List,java.lang.*" %>
<%!
//getting file name and url
Map mapfiles = new HashMap();
Map showFiles(File file)
{
File[] files = file.listFiles();
if(file.isDirectory())
{
for(int i=0;i<files.length; i++)
{
showFiles(files[i]);
}
}
else
{
String path = file.getPath();
String name = file.getName();
mapfiles.put(path,name);
}
return mapfiles;
}
%>

<%
File file_mem = new File("\\\\systemname\\dir1\\dir2\\dir3\\");
showFiles(file_mem);
out.println(mapfiles.size());
Iterator iterator_mapfiles = mapfiles.keySet().iterator();
while(iterator_mapfiles.hasNext())
{
boolean filefound_mem=false;
String fpath= (String)iterator_mapfiles.next();
String fname= (String)mapfiles.get(fpath);

// out.println(fpath +" " +fname+"<br>");
out.println(fpath+"<br>");
%>

<%--<a href="\<%=fpath%>">fpath</a>
<a href="\<%=fpath%>">fname</a><br>--%>
<%
}
%>

</P>
</BODY>
</HTML>


what has to be done
waiting for your reply



regards
santosh
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Report post to moderator
I guess this will helpful to you.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!