Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: help with reading a file, cannot instantiate

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default help with reading a file, cannot instantiate

    I am trying to read a plain text file off you the local computer , as far as I know the system is working except for a error I'm getting that I cant seem to get rid of. I haven't see this error before in this setting.

    Cannot Instantiate Type File
    the line of code that is causing the problem

    File inFile = new File(dirPath + foName);


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: help with reading a file, cannot instantiate

    Perhaps you have another, abstract, type called File somewhere.

    If so, remove it and import java.io.File (assuming that is the File you mean to use).

  3. The Following User Says Thank You to pbrockway2 For This Useful Post:

    umdoobby (November 30th, 2012)

  4. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: help with reading a file, cannot instantiate

    Briliant that worked, well that part works now

  5. #4
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: help with reading a file, cannot instantiate

    You're welcome. Good luck with the rest of the program!

Similar Threads

  1. Replies: 3
    Last Post: December 2nd, 2011, 11:53 AM
  2. Can't instantiate custom class
    By mwr76 in forum Object Oriented Programming
    Replies: 5
    Last Post: October 18th, 2011, 05:43 PM
  3. Is it possible to instantiate an interafce ?
    By Learner in forum Object Oriented Programming
    Replies: 7
    Last Post: September 2nd, 2011, 12:10 PM
  4. Could not instantiate bean class
    By Sheval in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 21st, 2011, 03:40 PM
  5. [SOLVED] instantiate problems
    By jamal in forum Object Oriented Programming
    Replies: 9
    Last Post: September 13th, 2010, 06:08 PM

Tags for this Thread