Issues with file path in java.io.File

I am getting file path in eclipse plugin using org.eclipse.swt.widgets.FileDialog and saving the path in XML files.
In web.xml , path is stored as below (I can't change backsladh to forwardslash or escape backslash since the value is coming from SWT FileDialog)
<init-param>
<param-name>filePath</param-name>
<param-value>c:\new\demo\next\version.txt</param-value>
</init-param>
In my filter , i have below code in init() method but am not able to get File reference due to special characters
String filePath = filterConfig.getInitParameter("filePath");
// Tried filePath.replace('\\','/') --> Didnot work since \n is a single character
File f = new File(path)

No it does not. You need to escape file paths properly. You can check this with simple code and that the problem i am facing now
     public static void main(String[] args) {
          String path = Messages.getString("filePath"); //in messages.properties put filePath=c:\new\next\verison.txt
          System.out.println(path);
          File f = new File(path);
          System.out.println(f.exists());
     }

Similar Messages

  • I am having an installation failure issue with my itunes 11 software.  File is corrupted and i don't know what to do.  I've un-install and re-installed the software three times and continue to get the same error message.  It states that "This copy of ITun

    I am having an installation failure issue with my itunes 11 software.  File is corrupted and i don't know what to do.  I've un-install and re-installed the software three times and continue to get the same error message.  It states that "This copy of ITunes is corrupted or is not installed correctly.  Please reinstall Itunes"
    iMac, iOS 6

    HI,
    If your old version of iTunes is still working - then I sugest you stick with that.
    iTunes 11 is a lousy update - It will not retain your playlists, you can't find and delete duplicates... and a whole arry of oyher issues. (have a look around this forum to see how many issues IT11 gives people)
    Just a friendly advise and warning :-)

  • How to use XSJS file path in Controller.js file

    Hi Experts,
    Regarding How to use XSJS file path in Controller.js file.
    I have gone through the SAP HANA Extended Application Services (Thomas Jung http://scn.sap.com/community/developer-center/hana/blog/2012/11/29/sap-hana-extended-application-services article.)
    Seems to be there is no information about the same. May be the article is targetted for Beginners and above. As I am a learner I am not able to do the same.
    var aUrl = '../../logic/demo_main.xsjs? (highlighted)
    Suppose my XSJS file is at http://ipaddress:8000/newtest/Func.XSJS.
    Can I use like below
    var aUrl = 'http://ipaddress:8000/newtest/Func.xsjs?
    or
    var aUrl = '../../newtest/Func.xsjs?
    I tried with multiple options but not able to get the expected output.
    Can you please provide more details on this?

    Dear Thomas,
    I am a abap developer , recently we meet a problem on our webdynpro report performnace issue. As in the development, we use SALV_WD_TABLE to design a ALV. and verything work correctly in our DEV system.
    But after when our QAS system, there are more records for the ALV, one of them has 21000 records. And in the layout, we have a column as checkbox.
    If we click any one checkbox, then the layout will respond almost 1~2 minutes. With debug I found the most time cost in the standard program.
    And with search I found that you have solution to solve it as 1,000,000 rows.
    So is it possible to provide some idea or solution to us?
    Many thanks for your help!
    BR
    Vincent Chen

  • Changing File path for different TIFF files in a For loop

    Hi dear users:
    I am using "IMAQ write TIFF File.vi" that basically writes a TIFF file to a specified file path. However, I would like to CHANGE the file path for each TIFF file i save in a for loop. The reason for this is that the File path has to include the file name and I do not want to write over the same file name all the time in a for loop. What I would like to have are sequential TIFF images. So if the file name would be "Image", I would like the result to be Image0, Image1, Image2 and so forth when I run my For loop. Can anyone help me with this?
    Thanks

    Use the "Format Into String" and the "Build Path" functions:
    Message Edited by smercurio_fc on 06-26-2007 05:16 PM
    Attachments:
    Example_BD.png ‏3 KB

  • How to get full file path while uploading a file in flex Applications

    How to get full file path while uploading a file in flex applications.
    FileReference Object is giving file name and other details but not the actual path.
    Is there any workaround to to get the file path?.
    Thanks

    Why not ask in the Flex forum; it is more likely that someone over there knows.

  • UNC paths and java.io.file in Oracle

    Hi,
    I'm just getting to grips with using some basic java in the database. I'm using 8.1.7 on W2K.
    I'm trying to test for the existance of a file on a separate w2k domain:
    import java.io.File;
    public class JFileExists {
    public static int fileexists (String fileName) {
    File myFile = new File (fileName);
    boolean retval = myFile.exists();
    if (retval) return 1; else return 0;
    public static void main (String args[]) {
    System.out.println (
    fileexists (args[0])
    grant javasyspriv to mp;
    function jfn_file_exists (file_in IN VARCHAR2) RETURN number
    AS LANGUAGE JAVA NAME 'JFileExists.fileexists (java.lang.String) return int';
    From the command prompt all is well:
    E:\java>"c:\oracle\ora81\Apache\jdk\bin\java.exe" JFileExists i:\test.txt
    1
    E:\java>"c:\oracle\ora81\Apache\jdk\bin\java.exe" JFileExists \\mpweb1\image\test.txt
    1
    But when loaded into oracle its returning false with the UNC path. (but is ok with a mapped drive to the same path)
    SQL> declare
    2 begin
    3 pa_main.pr_print(to_char(pa_main.jfn_file_exists('I:\test.txt')));
    4 pa_main.pr_print(to_char(pa_main.jfn_file_exists('\\mpweb1\image\test.txt')));
    5 end;
    6 /
    1
    0
    PL/SQL procedure successfully completed.
    The oracleservicesid and listener are starting under a user called oracle_user which is a member
    of the admins and domain admins group.
    mpweb1 is on a separate domain to the database server mpdb1 but it also has a user called oracle_user with the same password.
    oracle_user has full access to the share in question.
    Am I missing something? I was trying to keep the database server and web server on different domains for better security
    - but would things be easier if they were on the same domain?
    Any help much appreciated for this java newbi!
    Thanks,
    Simon.
    null

    I am also having problems with UNC paths. But I cannot access the location even if it is mapped as a drive. In JDK VJM I do not have a problem, but in Oracle it says the file cannot be found and say permission denied. I will try to change the user that starts the database and see if that helps.
    null

  • Issues with Importing and Flattening Complex AI files (Flash CS3)

    Is there an easy way to break apart vector graphics imported
    from Adobe Illustrator? My group creates most of the graphics in
    Adobe Illustrator and then we import them into Flash to animate
    them. Unfortunately, with layers and layers on complex drawings,
    Illustrator 3D, clipping masks, compound paths, etc... Flash tends
    to choke. If we take the time to break the graphics apart to a flat
    drawing, it drastically improve speed, and shrinks the file size of
    the resulting swf. Currently we distribute everything to layers,
    break then, and repeat. If there are clipping masks, then we have
    to enter each clipping group movie clip and delete the mask one by
    one to continue breaking the image apart. It's very time consuming
    and reduces our workflow. Is there a better way?
    Thanks in advance....

    So far, I'd like to report on 3 different solutions to this
    problem:
    1. Flattening the image in illustrator, by first, expanding
    any 3D objects (usually a good idea to preserve the original 3D
    either in another file -- keep the original), flattening the
    artwork, then release the clipping masks and compound paths, then
    ungrouping everything, and saving the resulting file (Preferably as
    a new file to keep all the original in case it needs to be adjusted
    later). Then import to flash and break it apart.
    Known Issues: Sometimes, pieces of the Illustrator 3D objects
    will move to the front when you release the clipping masks. You can
    move them back in illustrator or flash to correct the problem.
    2. Export the file from illustrator directly to a swf. Then
    drag that swf into the library and flatten the file from there.
    Known issues: The generated curves are approximated and don't
    always match up perfectly.
    3. Export the file from illustrator to a EPS file format,
    then drag the resulting file into flash.
    Known Issues: The generated curves don't always match up to
    the original and some 3D pieces may end up in front that belong in
    the back.
    4. Export as a raster file.
    Known Issues: You cannot zoom in tight when needed and still
    maintain the crisp lines (unless you rasterize at a very high
    resolution. This will unfortunately result in a large file size.
    The most accurate method for preserving original quality so
    far is the original method from the originating post.

  • Relaive file paths in Java

    Hi,
    I have a file in c:\dev\core\CSF\csf\data\test.txt.
    My current directory is c:\dev\core\CSF\csf\build
    From my current working directory howdo i access test.txt using relative path.
    My code from is as follows
    Object.setKeystore("file://../data/test.txt"); NOte that i need a URL because the setKeystore() requires sURL as its input.The above code does not seem to change the directory from c:\dev\core\CSF\csf\build to c:\dev\core\CSF\csf\data\test.txt

      // Get the parent of a relative filename path
        File file = new File("Ex1.java");
        String parentPath = file.getParent();      // null
        File parentDir = file.getParentFile();     // null
        // Get the parents of an absolute filename path
        file = new File("D:\\almanac\\Ex1.java");
        parentPath = file.getParent();             // D:\almanac
        parentDir = file.getParentFile();          // D:\almanac
        parentPath = parentDir.getParent();        // D:\
        parentDir = parentDir.getParentFile();     // D:\
        parentPath = parentDir.getParent();        // null
        parentDir = parentDir.getParentFile();     // null
        //Don't have to use setKeystore... can just convert it it as follows....
        File file = new File("filename");
        // Convert the file object to a URL
        URL url = null;
        try {
            // The file need not exist. It is made into an absolute path
            // by prefixing the current working directory
            url = file.toURL();          // file:/d:/almanac1.4/java.io/filename
        } catch (MalformedURLException e) {
        // Convert the URL to a file object
        file = new File(url.getFile());  // d:/almanac1.4/java.io/filename
        // Read the file contents using the URL
        try {
            // Open an input stream
            InputStream is = url.openStream();
            // Read from is
            is.close();
        } catch (IOException e) {
            // Could not open the file
        }I hope this helps.

  • Having issues with SP9 and IDMUI5/IDMREST SCA files

    Hello,
    I've been working through an upgrade to SP9 and have run into two issues related to some SCA files. I'm hoping others might be able to shed some light on how to resolve them. The issues primarily focus on unresolved dependencies for files I'm unable to locate.
    *Prior to performing this upgrade I downloaded all relevant SP9 files.
    In performing this upgrade, I've followed these steps:
    1) update database schema. completed successfully
    2) upgrade the runtime components. completed successfully
    3) upgrade the management console. completed successfully
    4) deploy IDM user interface on NW 7.3. This is where I ran into problems.
    Problem #1 - the IDMUI5 SCA file does not pass the validation check.
    - it states there is an unresolved dependency.
    - sap.com/tc~idm~rest~ear was not found
    Problem #2 - the IDMREST SCA file does not pass the validation check.
    - it states there are two unresolved dependencies
    - sap.com/tc~odata4j~primary was not found
    - sap.com/tc~jax~rs~primary was not found
    What I'd like to understand is where the files required by IMDUI5 and IDMREST exist and how to complete the upgrade for them.
    Thanks, Paul

    I think this is the odata4 that you need for 7.3
    SCA
    ODATACXFEXT11_0-10012140.SCA
    SP11 for SAP ODATA4J+CXF-REST LIB 7.30
    0
    Info
    10352
    26.02.2014
    This might be the only package you need; it might be in your best interest to avoid manually downloading files and rely upon Solution Manager's MOpz feature to query your IdM system and let it track down all the needed packages.

  • Performance Issues with large XML (1-1.5MB) files

    Hi,
    I'm using an XML Schema based Object relational storage for my XML documents which are typically 1-1.5 MB in size and having serious performance issues with XPath Query.
    When I do XPath query against an element of SQLType varchar2, I get a good performance. But when I do a similar XPath query against an element of SQLType Collection (Varray of varchar2), I get a very ordinary performance.
    I have also created indexes on extract() and analyzed my XMLType table and indexes, but I have no performance gain. Also, I have tried all sorts of storage options available for Collections ie. Varray's, Nested Tables, IOT's, LOB's, Inline, etc... and all these gave me same bad performance.
    I even tried creating XMLType views based on XPath queries but the performance didn't improve much.
    I guess I'm running out of options and patience as well.;)
    I would appreciate any ideas/suggestions, please help.....
    Thanks;
    Ramakrishna Chinta

    Are you having similar symptoms as I am? http://discussions.apple.com/thread.jspa?threadID=2234792&tstart=0

  • Nfs mount point does not allow file creations via java.io.File

    Folks,
    I have mounted an nfs drive to iFS on a Solaris server:
    mount -F nfs nfs://server:port/ifsfolder /unixfolder
    I can mkdir and touch files no problem. They appear in iFS as I'd expect. However if I write to the nfs mount via a JVM using java.io.File encounter the following problems:
    Only directories are created ? unless I include the user that started the JVM in the oinstall unix group with the oracle user because it's the oracle user that writes to iFS not the user that creating the files!
    I'm trying to create several files in a single directory via java.io.File BUT only the first file is created. I've tried putting waits in the code to see if it a timing issue but this doesn't appear to be. Writing via java.io.File to either a native directory of a native nfs mountpoint works OK. ie. Junit test against native file system works but not against an iFS mount point. Curiously the same unit tests running on PC with a windows driving mapping to iFS work OK !! so why not via a unix NFS mapping ?
    many thanks in advance.
    C

    Hi Diep,
    have done as requested via Oracle TAR #3308936.995. As it happens the problem is resolved. The resolution has been not to create the file via java.io.File.createNewFile(); before adding content via an outputStream. if the File creation is left until the content is added as shown below the problem is resolved.
    Another quick question is link creation via 'ln -fs' and 'ln -f' supported against and nfs mount point to iFS ? (at Operating System level, rather than adding a folder path relationship via the Java API).
    many thanks in advance.
    public void createFile(String p_absolutePath, InputStream p_inputStream) throws Exception
    File file = null;
    file = new File(p_absolutePath);
    // Oracle TAR Number: 3308936.995
    // Uncomment line below to cause failure java.io.IOException: Operation not supported on transport endpoint
    // at java.io.UnixFileSystem.createFileExclusively(Native Method)
    // at java.io.File.createNewFile(File.java:828)
    // at com.unisys.ors.filesystemdata.OracleTARTest.createFile(OracleTARTest.java:43)
    // at com.unisys.ors.filesystemdata.OracleTARTest.main(OracleTARTest.java:79)
    //file.createNewFile();
    FileOutputStream fos = new FileOutputStream(file);
    byte[] buffer = new byte[1024];
    int noOfBytesRead = 0;
    while ((noOfBytesRead = p_inputStream.read(buffer, 0, buffer.length)) != -1)
    fos.write(buffer, 0, noOfBytesRead);
    p_inputStream.close();
    fos.flush();
    fos.close();
    }

  • Issue with XSL transformation in Java Stored Procedure

    Hi,
    Am having issue applying XSL transformation in Java Stored procedure. I have loaded the java class as well as .XSL files through loadjava uility and their status in DB is VALID.
    Below is the code in the java stored procedure:
    public static String tranform(String strInputXML ){
    URL url = ClassLoader.getSystemClassLoader().getResource(first.xsl);
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream (strInputXML.getBytes("UTF-8")));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    StreamSource stylesource = new StreamSource(url.openStream());
    Transformer transformer = tFactory.newTransformer(stylesource);
    When I run this procedure, am getting following errors:
    {color:#ff0000}*ERROR: 'No such file or directory'*
    FATAL ERROR: 'Could not compile stylesheet'{color}
    My first.xsl file has reference to other excel file (Ex: &lt;xsl:include href="second.xsl"/&gt;) which seems to be causing this error. When I remove the reference, procedure is working fine.
    Pls let me know how to resolve this and read the .XSL file with references.
    Thanks,

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • File path for application server file

    Hi All,
                 I have a file 'abc.doc' stored on the application sever.
                I want to crate a document using the BAPI_DOCUMENT_CREATE and store this file
                What is the file path that I need to pass into the bapi.
    Please help
    Warm Regards
    Sunil Kumar.

    Hello Sunil
    You are right. That's the file path you should specify. It looks like your application server is running on UNIX platform. You can use transaction AL11 to locate your file and specify the file path in normal unix format. If this doesnt work, you can try prefixing your file path with "file:// ".
    Cheers
    Anand

  • Getting a file name using java.io.file

    Dear List,
    I am having problems using java.io package. I am reading a string on a linux tomcat server. I am
    trying to parse a windows type filepath (passed by a web-browser-client) and get only the filename. ie. sample.jpg.
    fileName = "c:\\temp\\sample.jpg"
    java.io.File file = new File(fileName);
    onlyFileName = file.getName();
    remember this on linux, and on my server onlyFileName contains "c:\\temp\\sample.jpg" and not sample.jpg as I would expect.
    can any one tell me what I (yet again) dont understand.? Strangely enough when the server is on windows and I am passing a linux string with the fileseperator as a forward-slash, the code manages to derive the correct filename.
    regards
    Ben

    Post this to the beginners forum - has nothing to do
    with native methods.Apologies I thought Java.io would be "native".
    sorry,
    BB

  • Having a weird issue with my assign after java embedding

    hi,
    I'm having a weird issue with my assign activity, i am using a Java Embedding wherin i access a variable and assign it some data, later in next step when i try to assign some other data to this same variable in assign activity i get a Error message as below.
    com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} parts: {{ summary=Invalid to part type. When performing the assign operation, the to node THIS,IS,,TEST is invalid. The node named in the error message was either null or an empty node set, and it was not an instance of org.w3c.Element. Verify the node value at line number 795 is not null and is an instance of org.w3c.Element. } .
    i'm using soa 11.1.1.5
    Can anyone please help ?
    - Thanks
    Shirish

    Shirish,
    It's a bug and you will need to apply a patch for that.
    You can find all explanation in Oracle Support Id ID 1194228.1.
    Arik

Maybe you are looking for