2 Replies Latest reply on Apr 8, 2008 6:31 PM by 800323

    How to consider \t in a String as a normal text


      I got problem when doing my java assignment. I have myProgram.java, when running the program, I need to paste in argument which is a filename as below:
      java myProgram .\tests\test1.cmd
      Here is my main()
      public static void main( String args[]){    
                String sourceFile = args[0];
                System.out.println("--sourceFile=[" + sourceFile + "]");
                PushbackReader     pr = new PushbackReader(new FileReader(sourceFile));
      However, the sourceFile is no longer as ".\tests\test1.cmd", the "\t" was recognized as a tab. And therefore, myProgram fail for trying to access the sourceFile.

      Is there anyway to handle this problem (without changing the sourceFile to another name)? Tkx everyone..

      Edited by: java_newbie82 on Apr 8, 2008 10:43 AM