Results 1 to 2 of 2
  1. #1
    snallami is offline Member
    Join Date
    May 2012
    Posts
    1
    Rep Power
    0

    Default Issue with reading file path

    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 = filePath.replace('\\','/') --> Didnot work since \n is a single character
    File f = new File(path)

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: Issue with reading file path

    If you know there should not be any valid lineend characters in the String, then replace \n with /
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 7
    Last Post: 03-05-2012, 06:26 PM
  2. Issue reading 375M text file with java
    By Nish_biz in forum Advanced Java
    Replies: 11
    Last Post: 12-12-2011, 01:33 PM
  3. Reading and writing the file in a specified path
    By harsha.udupa2008 in forum New To Java
    Replies: 4
    Last Post: 04-23-2010, 12:48 PM
  4. reading file from a path
    By new_coder in forum New To Java
    Replies: 5
    Last Post: 08-17-2009, 05:52 AM
  5. Weird path problem when reading properties file
    By jerry_popperq in forum New To Java
    Replies: 0
    Last Post: 03-18-2009, 04:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •