'symbol not found' class instansiation
I know posts like this are pretty common, but please humour me on this one, it's really annoying. (And before anyone asks the classpaths are fine ;-)
import java.awt.*;
import java.applet.*;
publicclass Gameextends Applet
{
publicvoid paint(Graphics g){}
publicvoid init()
{
Player player =new Player();
this.setLayout(new FlowLayout());
Panel panel =new Panel();
add(player.playerP);
}
}
[code]
[code]
import java.awt.*;
publicclass Playerextends Panel
{
publicstatic Panel playerP =new Panel();
/** Creates a new instance of */
public Player(){}
}
1) Paste in the exact, complete error message, and indicate clearly which line it's referring to.2) If you're getting that error, don't assume your classpath is fine.
jverda at 2007-7-10 11:31:00 >

You wanted errors:
init:
deps-jar:
Compiling 1 source file to /classes
Game.java:10: cannot find symbol
symbol : class Player
location: class Game
Player player = new Player();
Game.java:10: cannot find symbol
symbol : class Player
location: class Game
Player player = new Player();
2 errors
class Player compiles fine.
> You wanted errors:
Yesterday. Fortunately I was still watching the topic, but would have normally abandoned it.
Ok, so the error is all about your classpath being incorrect. I'm not sure what build tool you're using (ant?), but in its configuration you have not set up the proper classpath. So when the compiler tries to compile the Game class and sees a reference to a "Player" class, it doesn't know where it is. How does it find dependent classes? Via the classpath. You need to research and get a good grasp of what a classpath is all about.