Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   dynamically search user input files (http://www.go4expert.com/forums/dynamically-search-user-input-files-t17220/)

Juuno 29Apr2009 19:30

dynamically search user input files
When we want to open a file from java program, we use the following syntax.
File namefile = new File ("file-path\\file-name");
eg. File namefile = new File("C:\\Workspace\\myapplication\\mydata.xml")

But instead of that 'mydata.xml', i would like to get the file name from the user input and accept it with variable and then I will search it whether it exists in the folder I specified, in that case, I know the location except the file name coz the user will input it.

File namefile = new File("C:\\Worksapce\\myapplication\\variable-for-user-input")

how can I do this?

Thanks in advance!!

shabbir 29Apr2009 19:47

Re: dynamically search user input files
Use StringBuffer to get the final string

All times are GMT +5.5. The time now is 12:24.