File problem - checking the existence of a remote file

I have absolute paths to several text files from a ftp server (which don't require any
authentication and can be accessed over the internet).
I am trying to write a Java method that can check any of the above absolute ftp file
paths and returns true/false depending on whether the file exists/doesn't exist.
I tried somewhat this way:
File current_file = new File(absolute_file_path);
// absolute_file_path comes as a parameter
// e.g. "ftp://ftp.test.com/myfile.txt"
if(current_file.exists()) return true;
// if the file exists return true
return false;
// otherwise return false
Then I ran the program in my local machine which has internet access. But it returned
false for all the files (even if the file exists). Seems like it's unable to get those
files.
Could someone please tell me how can I rewrite my program so that it can be executed
locally.
Thanks,
SQ

Does anyone know if URL and URLConnection support FTP
directly? I can imagine downloads being simple, but
how about uploads? Never tried with FTP myself.Yes, they do. But uploads don't work properly with Java 1.3. (Note: I only know this because I've seen questions asked about it here, not from personal experience.) If I wanted to know whether a certain file existed on an FTP server, I would use an FTP client that could tell me that. Such as the Jakarta Commons/Net FTP client.

Similar Messages

  • Any means to check the existence of a .pdf file before opening in SAP GUI

    Dear,
    I've learnt from one of the thread that there is a sample program SAP_PDF_VIEWER_DEMO that allows us to open a .pdf file within a SAP windows.
    However, I would like to know if there are any means to perform a checking on the existence of the .pdf file first before calling the method open_document as coded in the demo program.
    Thanks a lot for your advise in advance,
    Francis

    where is this pdf file is ? in user desktop?
    if yes you can simply use cl_gui_html_viewer for viewing pdf files. and you can use cl_gui_frontend_service=>file_exists method to check whether the file exists
    Raja

  • How to check the existence of file without any error dialog?

    Hi everybody,
    I am trying update some labview programs from LV6.1 to LV7.1, I used the
    function "File/Dictionary Info" to check if the file
    exists or not (if the size=0 then file does not exist), and it ran well with
    LV6.1, but now it shows every time a labview error dialog
    about "LabView: file not found..." with 7.1, if this file dosn't exist.
    Sometimes I feel that it is really stupid to show the dialog, because I
    can write handling by myself, if the error should be handled, and
    I don't want all the process is interrupted because of such dialogs. Is
    there any way to shut the dialog down or check the existence of
    file smoothly?
    Thanks a lot!
    L.Wang

    Hello,
    The dialog is probably appearing because you have Auto Error Handling turned on.  This feature is turned on by default in LabVIEW 7.0.  You should go to VI Properties (Ctrl-I) > Execution and deselect "Enable automatic error handling".  Also you should go to Tools > Options > New and Changed in LabVIEW 7.x and deselect "Enable automatic error handling in new VIs".  If you never want to see one of those dialogs again, you can also deselect "Enaeble automatic error handling dialogs"...I wouldn't recommend this, however, as you would never know if one of your VIs had this setting enabled...you would only find out once somebody else tried to use your VI on another LabVIEW install.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Problem with the EFI system partition's file system.

    I installed latest yosemite 10.10.2 update - did a verify disk on “WDC WD1001FALS-403AA0 Media” (internal HD on my iMac 21.5-inch, Mid 2011) and got
    Problems were found with the partition map which might prevent booting
    Error: The partition map needs to be repaired because there’s a problem with the EFI system partition’s file system.
    However a verify disk on the volume partition gets a clean bill of health!
    I haven't done a 'repair disk' yet. Thought I'd check if anybody else has same message first.
    Cheers

    I had issues where my MacPro 8-core would not boot after the 10.7.4 upgrade, but my MacBook Air 13" 2011 upgrade worked just fine.
    I had to restore my MacPro HD from my TimeMachine back up. Apparently, the Softraid raid drivers that I use on my MacPro are not compatible yet with 10.7.4. See here for more info:
    http://macperformanceguide.com/blog/2012/20120511_1-MacOSX-SoftRAID.html
    I contacted Softraid and they are already aware of the issues and are working with Apple for a fix.
    Cheers.
    Bud

  • XSQL-001: Cannot locate requested XSQL file. Check the name.

    I downloaded oracle 9i and the latest beta of XDK for Java and
    encountered the following error:
    Oracle XSQL Servlet Page Processor 9.0.2.0.0C (Beta)
    XSQL-001: Cannot locate requested XSQL file. Check the name.
    Since I am using JBuilder5, I configured the bundled Tomcat to
    reference the XSQL Servlet as per the described docbase setting.
    n.b.: I am not running a web or application server at this time.
    Tomcat is my servlet container which I directly connect to from
    my browser.
    I extracted the XDK into the oracle\ora90 folders. I extracted
    XDK to my oracle\ora90 folder, since
    the "bundled" XDK is located there already, and it appeared to
    be lacking the XDK for Java.
    I read the xdkload.bat, and it appeared to be required to
    resolve earlier undefined methods
    issues as per the documentation, so I gambled and ran it. BTW,
    unresolved methods was my initial problem.
    The attached files describe a method not defined error. Not sure
    how to proceed. Thanks.

    I should have added the associated Tomcat trace. Note the
    exception, java.lang.NoSuchMethodError, which is possibly the
    real issue.
    2001-10-21 06:23:07 - ContextManager: Adding context Ctx
    ( /examples )
    2001-10-21 06:23:07 - ContextManager: Adding context Ctx
    ( /admin )
    2001-10-21 06:23:07 - ContextManager: Adding context Ctx( /test )
    2001-10-21 06:23:07 - Ctx( /xsql ): Set debug to 1
    2001-10-21 06:23:07 - ContextManager: Adding context Ctx( /xsql )
    2001-10-21 06:23:07 - ContextManager: Adding context Ctx( )
    2001-10-21 06:23:07 - Ctx( /xsql ): XmlReader - init /xsql
    E:\oracle\ora90\xdk\demo\java\xsql
    2001-10-21 06:23:07 - Ctx( /xsql ): Reading E:\oracle\ora90
    \xdk\demo\java\xsql\WEB-INF\web.xml
    2001-10-21 06:23:07 - Ctx( /xsql ): Loading -2147483646 jsp
    2001-10-21 06:23:08 - PoolTcpConnector: Starting
    HttpConnectionHandler on 8080
    2001-10-21 06:23:08 - PoolTcpConnector: Starting
    Ajp12ConnectionHandler on 8007
    2001-10-21 06:31:37 - Ctx( /xsql ): Exception in: R( /xsql
    + /fly/index.xsql + null) - java.lang.NoSuchMethodError
         at oracle.xml.xsql.XSQLConfigManager.reloadConfigFile
    (XSQLConfigManager.java:480)
         at
    oracle.xml.xsql.XSQLConfigManager.insureConfigurationIsLoaded
    (XSQLConfigManager.java:190)
         at oracle.xml.xsql.XSQLPageManager.getPage
    (XSQLPageManager.java:73)
         at oracle.xml.xsql.XSQLPageRequestImpl.getXSQLPage
    (XSQLPageRequestImpl.java:454)
         at oracle.xml.xsql.XSQLPageProcessor.process
    (XSQLPageProcessor.java:85)
         at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:60)
         at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService
    (ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service
    (Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service
    (ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService
    (ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service
    (ContextManager.java:743)
         at
    org.apache.tomcat.service.http.HttpConnectionHandler.processConne
    ction(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt
    (PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run
    (ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:484)

  • How to check the resolution of a pdf file using Acrobat 9 pro?

    How to check the resolution of a pdf file using Acrobat 9 pro?

    PDF files don't have one resolution, but may have none or many different resolutions, one per image. You can check the maximum/minimum resoluion with preflight in Acrobat Pro, but not in Adobe Reader.

  • Error in loading the WSDL file. Check the error log for more details

    Hello,
    I am trying to create a Import Adaptive Webservice Model. I am using the WSDL:
    http://www.abysal.com/soap/AbysalEmail.wsdl
    I am getting the below error when I choose WSDL source as UDDI or file (I am not using any logical destination)
    "Error in loading the WSDL file. Check the error log for more details."
    Where can i see the error log? And what is the solution to fix this?
    I am able to create the model if i save the wsdl locally on my machine and choose Local File System or File as the WSDL source. But at runtime this fails as the application tries to read the WSDL for metadata info and it looks into the application server for this file.
    I also tried creating the old webservice model. And it is able to create the model. But I feel I need to use the new model as this one is deprecated.
    Thanks,
    Sachin

    Hi
    For the logs you can search in this directory
    Goto Window->Show view->Other->PDE Runtim->Error Log
    please try this may it would help you out, try to create a model for you Web Service using Web Service Model (DEPRECATED)
    See this link:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/ep/integration%2bof%2bweb%2bservices%2b-%2bdifferent%2bscenarios

  • MacBookPro SSD Error- ALERT: The partition map needs to be repaired because there's a problem with the EFI system partition's file system.

    MacBook Pro OS x Mavericks. I have Sandisk 256GB SSD and I am getting a below error message.
    ALERT: The partition map needs to be repaired because there's a problem with the EFI system partition's file system.
    Does anyone know how to resolve this error and fix it ? unfortunately I don't have a Time Machine backup. Thanks!

    Have you tried to run the verify/repair permissions and verify/repair disk through the recovery disk? If that didn't work then I would reinstall the OS after backing up. If that still doesn't work I would take it in.

  • How to reliably check the resolution for a pdf file?

    Should I use preflight to reliably check the resolution for a pdf file?  I have posted my frustrations on http://forums.adobe.com/thread/978098

    You can create your own preflight tool to check for the dpi of embedded images.

  • Error(12,61): Parse of component type files failed, check the adf-config

    I got this error when i wanted to deploy CreditCardValidation
    Error(12,61): Parse of component type files failed, check the adf-config.xml file : "java.lang.reflect.InvocationTargetException"

    I got this error when i wanted to deploy CreditCardValidation
    Error(12,61): Parse of component type files failed, check the adf-config.xml file : "java.lang.reflect.InvocationTargetException"

  • Error: License File Exception (check the log file for details): ENT_PE_NODE not found in datastore

    Hi;
    i have install 2 MCS 7816 (publisher and suscriber) with call manager version 6.1, i have load the files licenses for the publisher and the phones, but when i load the file license for the suscriber in publisher server i had the error messeage :
    Error : License File Exception (check the log file for details): ENT_PE_NODE not found in datastore
    what s the solution.
    Thanks for your help

    Hello,
    I seen this issue before, all you have to do is Contact Cisco Licensing team. In order to generate new licenses for your server.
    Thanks,

  • Is there any FUNCTION I can use to check the existence of a USER?

    Hi,
    Is there any FUNCTION I can use to check the existence of a USER? I dont want to write a function by myself to access usr01 directly.
    Thanks in advance.

    You can use FM USER_EXISTENCE_CHECK
    Thanks
    Seshu

  • How to check the existence of DB400 library from java

    Hi all,
    I actunally need to validate a DB400 library via java. so is there any way to check the existence of DB400 library from java side.
    Thanks in advance.

    Hi Sarvan,
    You might not even need a function to tell you if a record exists or not.
    Here in below example i do a check with exists .you will find couple of other ways too..
    create table t as select * from emp where deptno=10now i set salary of every person present in table 'T' to 1111 in emp table.
    update emp e
    set sal=1111
    where exists
            (select 1
              from t
              where t.empno=e.empno) Remember that plain SQL will always outperform PLSQL.
    Hope it helps
    CKLP
    Edited by: CKLP on Sep 26, 2011 3:41 AM

  • Procedure to check the existence of Indexes

    I have a procedure whcih drops all the indexes, when the same procedure is executed again, it gives error "object does not exists" (obviously)
    I want to avoid this error, how can I check the existence of index inside the procedure, so that the procedure will check if the index exists before deleting the index?
    Is there a ready-made procedure available for such scenario?
    Thanks in advance

    The other approach is to catch the exception in your script, i.e.
    BEGIN
      EXECUTE IMMEDIATE 'DROP INDEX <<index name>>';
    EXCEPTION
      WHEN OTHERS THEN
        -- Drop failed.  Do something to record the failure.
        NULL;
    END;Now, most of the time, you'll want to catch a few specific exceptions and you'll want to do something when you catch them (i.e. generate a log entry).
    Justin

  • Programmatically check the existence of objects in the system

    Hi,
    Is there a way to programmatically check the existence of objects? The idea is I'll accept a list of names of objects and their object types and then programmatically check their existence in the system?
    Can you point me to a resource on how to do it?
    Thanks in advance.
    --Carl

    Hi.
    All custom objects (z, y) being referred to a program. May it be z or y table, data element, domain, sapscript form, function module/group.
    The goal is actually to be able to transport a program from a source machine to a target machine. The objects being referred to from the program must also be transported, of course, for it to run properly. Thus, the need to check the objects' existence.
    Thanks.
    --Carl

Maybe you are looking for