Access a file which is in local network via jsp

i try to access some files from a system in the network.
i couldn't make it through jsp and servlet
im using tomcat webserver.
but in core java it works finely.
the below r the example code...
core java coding(It works)
class a
public static void main(String ar[])
  String a="//software2/d$/Daily Shipment Backup";
      java.io.File f=new java.io.File(a);
      if(f.exists())   //whether the directory exists
  System.out.println("Exists");
      else
  System.out.println("Error");
}jsp coding
<html>
<%
  String a="//software2/d$/Daily Shipment Backup";
         java.io.File f=new java.io.File(a);
      if(f.exists())
  out.println("Exists");
      else
  out.println("Error");
%>
</html>

Tomcat (And other JSP/Servlet containers) have security restrictions which disallow you from accessing the local/remote file system. You will probably need to modify your security policy settings
I believe Tomcat stores this file in $CATALINA_HOME/conf/catalina.policy
You can read more here.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/security-manager-howto.html
Hope this helps
-Jeff

Similar Messages

  • Is it possible to access my TimeCapsule from outside my local network via internet? If so what is the best app  that  can help me?

    is it possible to access my TimeCapsule from outside my local network via internet? If so what is the best app  that  can help me?

    iCloud can do it..
    http://www.apple.com/au/support/icloud/back-to-my-mac/
    You need Lion and latest firmware on the TC..
    Were you hoping to use the ipad/iphone??  That maybe possible but I am not sure how.
    You cannot use windows without opening SMB to some strange port and this is going to mess with security.. you also need a static ip address from your ISP.. most private net users do not have this.
    You can do it via vpn.. you will need to buy a vpn router and bridge the TC to it.
    Just google remote access time capsule.. there are a zillion posts about it.

  • I have a new Apple TV which is working fine except that I cannot access .mov files which are in my iTunes Library. How can I get to these? I can run them on my computer and select Apple TV on the screen, but the Apple TV goes to a black screen

    I have a new Apple TV which is working fine except that I cannot access .mov files which are in my iTunes Library. How can I get to these? I can run them on my computer and select Apple TV on the screen, but the Apple TV goes to a black screen

    Mov is a container format, you'd need to look at the codec used by the movie file inside the container to know whether it will work with the Apple TV or not.

  • HT3702 Why can't I download my already purchased music and other files from iCloud, even though I owe money to iTunes for my most recent purchases.  Doesn't seem right that they keep me from accessing those files which I've already paid for!

    Why can't I download my already purchased music and other files from iCloud, even though I owe money to iTunes for my most recent purchases.  Doesn't seem right that they keep me from accessing those files which I've already paid for!

    - Are you saying that they are not listed in your Purchased section?
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    - Are they listed in your Puchases history when you log into your account on your computer?
    - Are they still available now for purchase? If not then you are out of luck
    If they are still available and listed in your Puchase History then contact iTunes
    http://www.apple.com/support/itunes/

  • I need to access a file which is present in LAN of our office.

    Hi,
    In windows I could access a remote file by giving the local IP address in the RUN command and then by giving the username and password I was able to access the files in the local server. But not able to do the same with my iPad?
    Ex: In windows in RUN Command I used to type // 192.168.1.100 ( my local server) after which I used to get a window showing username and password. Once I entered the username and password I was able to access the remote files on this IP and work accordingly.. This I'm not able to do in my IPad?
    Kindly give me a solution?

    There may be some apps in teh app store that would provide this, but no, you will not be able to do it with native iOS functionality.

  • [b]Need to access a file which is not specified in the classpath[/b]

    Hi everybody ,
    I need your help to proceed with my application. I've tried accessing a file without setting it in Classpath using getResourceAsStream(..), but i'm getting an error.
    error :
    java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
    at abc.func(LoadProp.java:13)
    at LoadProp.main(LoadProp.java:35)
    Application :-
    import java.io.* ;
    class test
    public void func(String file )
    String thisLine ;
    try
    InputStream is = test.class.getClassLoader().getResourceAsStream(file);
    System.out.println("File load successful");
    BufferedReader myInput = new BufferedReader(new InputStreamReader(is));
    while ((thisLine = myInput.readLine()) != null) {
    System.out.println(thisLine);
    catch (Exception e)
    System.out.println("Inside Catch");
    e.printStackTrace();
    public class LoadProp
    public static void main(String args[])
    String testname = System.getProperty("propfile");
    System.out.println(testname);
    test t = new test() ;
    t.func(testname) ;
    System.out.println("End Main!") ;
    Output:-
    test.properties
    File load successful
    Inside Catch
    java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
    at test.func(LoadProp.java:13)
    at LoadProp.main(LoadProp.java:35)
    End Main!
    Anyone of you help me to get rid of this problem..
    Thanks & Regards
    BK

    It has to be in the classpath for getResourceAsStream
    to "get" it.So if your question is really about needing to read a file which is not in the classpath and won't be, then as long as you have the path to that file, just use FileInputStream to read it.
    InputStream is = new FileInputStream(pathToFileHere);

  • How do I redirect everyone who access a specific website in my local network to another?

    I want to redirect everyone that is connected to my local network and try to connect to facebook.com, for example to another LOCAL website. It is a system like that which Hotels have to register users. Any Ideas?

    Google the following phrase:
    captive portal

  • Unable to access pdf files which were previously accessable.

    I have discovered a direcotry of PDF files that are archives of documents produced and accessable normally with even a reader version of Adobe. I have accessed these files easilly and without issue in the past. I have tried to access some of these documents today and they are all unaccessable.
    They are located on a network drive in one directory and its subdirectories.

    The message was
    "Acrobat could not open ........ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF"

  • Access the files of a web server through a JSP page

    Hello,
    Is it possible to access the files of a an Apache web server, just as you access your local machine.
    Basically i want to access the files of a specific folder, such as http://server:8080/foldername/ ,
    and get a list of all the files stored in there. I know how to do it for the local file system.
    File f = new File(server);
              File files[] = f.listFiles();
              for(int i=0;i<files.length;i++){
              if(files.getName().contains(" ")){
                   System.out.println(files[i].getName());

    This is really dependent on your web server. A web server isn't a shell and the closest equivalent I can think of barring webserver extensions is to configure directory listing to be allowed for the directory you're trying to, grab that html file listing, parse it, and use that to get a list of file names. This is not a very clean solution, so I suspect that whatever problem you're trying to solve, you're going about it the wrong way.
    Assuming Apache: [http://httpd.apache.org/docs/1.3/misc/FAQ.html#indexes|http://httpd.apache.org/docs/1.3/misc/FAQ.html#indexes]

  • Connecting to local network via Airport?

    Hi!
    How to set up the MacBook to reach computers on a local network, wirelessly?
    I have 4 computers on my local network. 3 macs, 1 pc.
    Set up is: Zyxel Prestige 2602R and a SonicWall wireless firewall.
    2 macs and the pc are connected to the router via cables.
    The MacBook is running wireless.
    Everything is fine connecting to the internet. But there is no conectivity
    to and from the MacBook, unless I connect it via a cable.
    What am I overlooking?
    JanD

    Check that you have sharing on all your computers set up. Also on your macbook you will need to set up sharing also. This is done under your system preferences window.
    You can connect to your other network computers in finder. Click network in the left finder pane and if they are set to share correctly you should see them come up. Just connect to them and a connection should show up in the left finder pane.
    Mort

  • Windows 7 64bit can't access Windows 7 32bit within the local network

    Hello,
    We have one 64bit PC and ten 32bit PCs in our local office network.
    Recently the 64bit PC is unable to access some of the other 32bit PCs in random basis. When it happens, all the other PCs are unable to access the 64 bit PC.However, the 64bit PC can still access the internet without problem.
    Everything will be back to normal after rebooting the 64bit PC.
    Is there any solution about this problem?

    Hi,
    First, this is not related to  a 32 bit machine or a 64 bit machine, also I want to know how can you access the other computers, visit a shared folder or remote desktop connection? This is related a network issue.Check whether the network discovery
    is turned off, to turn on network discovery:
    1. Open Advanced sharing settings by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type network, click Network and Sharing Center, and then, in the left pane, click Change advanced sharing settings.
    2.Click the chevron Picture of the chevron icon to expand the current network profile.
    3.If network discovery is off, under Network discovery, click Turn on network discovery, and then click Save changes.
    Details about shared folder visit can be seen:
    http://windows.microsoft.com/en-hk/windows7/why-can-t-i-connect-to-other-computers
    Regards
    Wade Liu
    TechNet Community Support

  • Need help setting up Pixma MX 860 on local network via wireless

    Ok, I'm at my wit's end here.
    I've spent the last two days trying to setup my printer with a connection to my wireless hub, and it simply refuses to work.
    I've tried under Win7 and Mac OS/X.
    Most recently, using Win7, I have the drivers installed, I have tried running 'ltdl-win-mx860-2_5_7-en.exe', and it sees the printer, then when it lists the access points, I see my access point.  I type in my password, and it says "Communicating with printer", then, after a few minutes, I get "The printer could not be connected to the specified access point."
    Please help me before I throw this printer through the window!
    AdvThanksance,
    -Mark
    PS  Yes, I have checked, double checked, triple checked my access point password.  That's not the problem.

    So you have a printer and wish to connect it to your network using wireless, right?
    I don't see what the Win 7 or OS-X boxes have to do with it?
    The connection you need to establish is between the printer and the Wi-Fi access point. Once that is established, everything else should flow.
    Start at the printer, it should lead you by the hand to connect to the wireless. Have you tried using the printer (not any computer) to connect to the wireless access point?
    Unless I am overlooking something else?
    regards,
    chmod

  • ACCESSING a file out of the web contex in JSP

    hi
    i'm a new JSP developer ius eclipse 3.2 environment and tomcat 5.
    i wanna include an html file from somewhere outside of the web directory (for exapmle "c:\test.html")with <jsp:include> ; but i cant!what shold I do?

    If you're going to be using a FileReader, piping the request through a servlet using FileIinputStream -> response.getOutputStream() seems the best option
    Putting it in a servlet means that you only send the contents of the file, without any of the extra carriage returns that can be included in a JSP.

  • SMB not working from outside local network

    Hello,
    On my old MacBook I installed OS X Server to create a file sharing server.  I set it up using my public IP address so that I could access my files from outside the local network.  I don't have an Apple router, but I found the port number for SMB and AFP and did the port forwarding.  My issue is that smb stopped working.  It used to work out side the network because it tested it.  My Mac can still connect though outside the local network using my public IP.  I have no clue why SMB is not working as it was working recently.  My only idea is that I got a new modem from my ISP.  Could that make a difference?  I don't get it because AFP still works fine.  File sharing using SMB is checked in the server app and file sharing preferences so it is not that.  I am using OS X 10.8.4 on a MacBook running OS X Server version 2.2.1.  Any help would be appreciated. 
    Thanks,
    Michael

    Is it a modem only, or is it a modem/router that might be creating a double-NAT on your network?
    Incidentally, since you're running Server, you might want to use the built-in VPN gateway to give yourself better security - tunneling AFP/SMB through a router/firewall is pretty insecure.
    Matt

  • Access the file from external system which is in the same LAN

    I have created technical system as standalone and given as my server name and attached to business system
    When creating comm. Channel giving path as “\foldername1\ foldername2\”
    Filename : “test.txt”.
    It is giving path does not exists.
    Is that the correct way to do access the file which is in the same LAN.
    Can any one help me on this.
    What path I should give exactly in the Comm channel..
    Thanks
    M

    Dear Murali,
    Try this
    a)Start transaction SXI_CACHE.
    b)From the context menu XI Runtime Cache select Start Complete Cache Refresh.
    If you still face issue try this .
    Many actions require to access System Landscape Directory content from the Integration Builder. To optimize performance, this content is loaded into a cache so that the System Landscape Directory does not have to be accessed directly each time that System Landscape Directory content is required.
    However, this cache is not automatically updated if changes are made to the content of the System Landscape Directory. For this reason that we delete the System Landscape Directory cache if changes have been made to content in the System Landscape Directory. The cache is then filled each time that the System Landscape Directory is accessed. If we log on to the Integration Builder after we have made a change in the SLD, we do not need to delete the SLD cache.
    To clear the SLD cache, from the Integration Builder main menu, choose Environment ® Delete Cache for SLD Data.
    Once we have deleted the cache for SLD data, accessing objects in the SLD may take longer than usual initially.
    Regards
    Agasthuri Doss

Maybe you are looking for

  • My Slow Mac Mini - will someone once and for all give me an answer!!

    I got a 1.25 ghz Mac Mini with 512 RAM running 10.4.4 . This thing has been so slow since I pulled it out of the box. I always get the colorwheel when doing just about anything. No, I don't have a bunch of apps open, just Safari and Mail. I tried clo

  • How do I use Mail (same setup) on two computers?

    I have a MacMini and a MacBook; both are running MtnLion 10.8.5.  The mini is my main computer. I used to have Snow Leopard on both.  When I traveled, I would copy my Mail folder and mail plist file to my Macbook and I was able to check/use Mail with

  • Schema Validation Error details

    Hi, I am trying to get hold of the error message thrown when validating the schema. Somehow I am not able to get the details using - getfaultasstring() function but I can see the exact error message in the EM console when I open up the instance. Is t

  • Ipod touch factory reset error, now won't respond

    I was resetting my Ipod touch 2g to factory settings, selected not to back up old info, and halfway through the restore itunes gave me an error message and quit the restore. Now my Ipod is stuck on the 'connect to itunes' screen, which it will not le

  • No batch input data for screen sapmf05A 0700 during BD20

    Hi, In BD20, when there are multiple idocs, after the first idoc is succesfully processd, the other idocs fail, as the first one has locked the screen and we get the message No batch input data for screen sapmf05A 0700. Then the other idocs end in er