Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Java Compiler Cannot Find a Class

  Asked By: Lorenzo    Date: Mar 07    Category: Java    Views: 969
  

I have a small issue, actually this issue has been bugging me since I
started the java programming language.

Overview:
Two classes
First Mian.java (main class)
Second Ball.java (helper class)

Now, both classes are public so the access is not restricted.

The problem:
When i try to compile main clas Main.java and in that class there is
an object Ball (instance of the ball class), compiler gives me err
that this class cannot be found (the Ball class)

How come, both are public, and both are in the same folder.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jay Richards     Answered On: Mar 07

Main.java uses Ball class  ie. Main depends on
Ball.java. So, compile  Ball.java first and get its
class file Ball.class. Then compile Main.java. It
should work.

 
Answer #2    Answered By: Wade Jordan     Answered On: Mar 07

Have you set your classpath???????????????

 
Didn't find what you were looking for? Find more on Java Compiler Cannot Find a Class Or get search suggestion and latest updates.




Tagged: