Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issues with file path in java.io.File

940941May 31 2012 — edited May 31 2012
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)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2012
Added on May 31 2012
5 comments
638 views