aspose file tools*
The moose likes Beginning Java and the fly likes New classes not recognised in main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "New classes not recognised in main" Watch "New classes not recognised in main" New topic
Author

New classes not recognised in main

And Green
Greenhorn

Joined: Sep 28, 2007
Posts: 26
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!)
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
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

Joined: Sep 28, 2007
Posts: 26
Yes I have Pete unfortunately.

Thanks for posting though
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39


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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
And Green
Greenhorn

Joined: Sep 28, 2007
Posts: 26
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
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New classes not recognised in main
 
Similar Threads
compiling with packages
Problem updating the JAR file
Compile error vs. Runtime error
ARGH! Package problem while using *
Cannot find symbol class