Delete Empty Spaces...
I got a jtxtfieldPath declare at up there to receive folder path from the user.
Then at the event handling part,this is the code:
File f1=new File(jtxtfieldPath.getText());
If the user input something like this at the text field,it will crash:
C:\users\aaa aaa aaa
It is because of the space...
What do I need to modified at the jtxtfieldPath.getText() part in order to eliminate all the empty spaces?
It is not the empty spaces that are giving you trouble... it is the backslashes... You need to escape them with another "\"... so it will be:
C:\\users\\aaa aaa aaa
String fileSep = System.getProperty( "file.separator" );
String theFilePath ="C:"+fileSep+"Documents and Settings"+fileSep+"Manager"+fileSep+"my file test.txt";
File file = new File(theFilePath);