Page 2 of 2 FirstFirst 12
Results 21 to 35 of 35
  1. #21
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,446
    Rep Power
    25

    Default Re: Files. What is wrong with this??

    Its an occupational hazard.

  2. #22
    Tullamore is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: Files. What is wrong with this??

    Ha...no. I tried that. I entered it before the import statements. It said I was missing an enum or class or something. So I tried it after the class statement. didn't work there either. Sorry man.

  3. #23
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,446
    Rep Power
    25

    Default Re: Files. What is wrong with this??

    You need to put Junky's code in the main method.

  4. #24
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Files. What is wrong with this??

    Wow! I guess I should have been explicit.

  5. #25
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,446
    Rep Power
    25

    Default Re: Files. What is wrong with this??

    It doesn't help. Post #13 implies to put the code after line 9.

  6. #26
    Tullamore is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: Files. What is wrong with this??

    I'm sorry guys, like I said, total beginner here. Here's what I did:

    Java Code:
    public static void main(String[] args)throws IOException
    	{
    		
    		String firstfile;
    		String secondfile;
    		Scanner keyboard= new Scanner(System.in);
    		
    		System.out.println(System.getProperty("user.dir"));
    
    		System.out.println("Enter the name of file 1");
    		firstfile= keyboard.nextLine();
    
    		System.out.println("Enter the name of file 2");
    		secondfile= keyboard.nextLine();
    
    		UpperCaseFile object= new UpperCaseFile(firstfile, secondfile);
    
    		System.exit(0);
    	}
    }
    and it returns nothing. Just the same error from before. Maybe I'm beyond help...i don't know.

  7. #27
    Tullamore is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: Files. What is wrong with this??

    Oops. Ok it returned this: C:\Users\olle\Documents\JCreator LE\MyProjects\UpperCaseFile\classes

    So. I should save my notepad file here then right?

  8. #28
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Files. What is wrong with this??

    What happened when you tried?

  9. #29
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,446
    Rep Power
    25

    Default Re: Files. What is wrong with this??

    Try it. It won't break anything and you'd be able to tell us what happened instead of waiting for our telling you what we think.
    Did you try printing the absolutePath for the File class? What does it print?

  10. #30
    Tullamore is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: Files. What is wrong with this??

    Ok. I tried it. And I get this:

    Enter the name of file 1
    abc.txt
    Enter the name of file 2
    ABC.txt

    Process completed.

    So when I go back in to abc.txt it should be Uppercase right? But it's not, nothing changed.

  11. #31
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,446
    Rep Power
    25

    Default Re: Files. What is wrong with this??

    Windows file names are not case sensitive.
    ABC.txt is the same file as abc.txt
    Use different filenames for input and output.
    In general for testing you should always use different filenames.

  12. #32
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Files. What is wrong with this??

    Unless it created ABC.txt in a different directory. If that is true then down the rabbit hole we go again.

  13. #33
    Tullamore is offline Member
    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    Default Re: Files. What is wrong with this??

    Holy crap! I finally got it. Wow..that was way harder than it should've been. Thanks a ton you guys! Also your patience is greatly appreciated. :)

  14. #34
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Files. What is wrong with this??

    Wooohoooo!

  15. #35
    lnkhanal is offline Member
    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0

    Thumbs up Re: Files. What is wrong with this??

    You must give the full file path in order to provide right job to the code. Program must know what to do on what.
    If I am not too primitive in java programming, this style is correct as I did in my code
    Java Code:

    public static void main(String[] args) throws IOException {
    ...
    File inputFile = new File("D:\\images\\myImage.png");
    ...
    }

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2013, 01:37 AM
  2. Replies: 2
    Last Post: 06-11-2011, 01:54 PM
  3. Creating Jar Files with functioning input files
    By appleLove in forum NetBeans
    Replies: 1
    Last Post: 04-10-2011, 10:37 PM
  4. Replies: 8
    Last Post: 07-30-2010, 05:47 PM
  5. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 03:20 PM

Posting Permissions

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