• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I suddenly can't make instances of 'File'

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I swear that yesterady this worked, then today... nothing.
Every time I try compileing it I get
Copy.java:5: cannot find symbol
symbol : constructor File(java.lang.String)
location: class File
File inputFile = new File("listofregions.txt");
I've tried reinstalling java, checked classpath, what have I done wrong?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chaz,
That line should certainly compile. What command are you using to compile?
> javac Copy.java
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have most likely created your own class named "File"; either File.java or File.class is on your classpath, someplace. Find it, delete it, don't do that again!
 
Chaz Andrews
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
You have most likely created your own class named "File"; either File.java or File.class is on your classpath, someplace. Find it, delete it, don't do that again!



lol, thats it. Cheers guys.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, that wouldn't have happened if you had used a fully qualified import:

import java.io.File;

Another reason not to use wildcard imports...
 
reply
    Bookmark Topic Watch Topic
  • New Topic