• 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

New classes not recognised in main

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

Got a new problem. I'm guessing it's basic but I'm at the point I need some help.

I'm currently writing new classes and compiling them successfully, when I try to reference the new class types in a main method (in a separate file but same directory) the main method cannot find my new classes and will not compile.

("cannot find symbol class: <classname>")

Both classes/files are in the same directory. Neither file belongs to any package.

My PATH environment variable seems to be OK, because the new classes compile OK, they just can't be used by other classes or files in the same directory.

Any ideas? (I'm imagining the answer may be quite embarassingly obvious!)
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

And Green wrote:I'm currently writing new classes and compiling them successfully, when I try to reference the new class types in a main method (in a separate file but same directory) the main method cannot find my new classes and will not compile.

("cannot find symbol class: <classname>")

Both classes/files are in the same directory. Neither file belongs to any package.
Any ideas? (I'm imagining the answer may be quite embarassingly obvious!)



Have you tried fixing the package issue -- putting all your code in proper packages?
 
And Green
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I have Pete unfortunately.

Thanks for posting though
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It may also help if you provided more details, such as... do you have a CLASSPATH set? How are you compiling it? And the exact output of the error messages.

Henry
 
And Green
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:
It may also help if you provided more details, such as... do you have a CLASSPATH set? How are you compiling it? And the exact output of the error messages.

Henry



It was the classpath! Many thanks Henry and sorry to trouble you (and anyone else) with this.

(embarassed emoticon)
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

And Green wrote:
It was the classpath! Many thanks Henry and sorry to trouble you (and anyone else) with this.

(embarassed emoticon)




No problem. After all, that is what the "beginning java" forum is for... glad we were able to help.

Henry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic