• 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

cannot resolve symbol

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm trying to build a simple nokia phone game. i copyed the code elsewhere to c if it works, and i got this problem that i cant resolve, my code is:

/* HardDriveMIDlet.java : Container MIDlet */

import java.io.IOException;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;

public class HardDriveMIDlet
extends MIDlet
implements CommandListener
{

private Display dgDisplay;
private HardDriveCanvas hdCanvas;
private GameOverCanvas goCanvas;

static final Command ExitCommand = new Command("Exit", Command.EXIT, 0);

public HardDriveMIDlet( )
{ // Create the main Display
dgDisplay = Display.getDisplay(this);
}

protected void startApp() //throws MIDletStateChangeException
{
try{
hdCanvas = new HardDriveCanvas(this, "/car.png", "/obstacle.png");
hdCanvas.start();
hdCanvas.addCommand(ExitCommand);
hdCanvas.setCommandListener(this);
}
catch (IOException ioe)
{
System.err.println("Problem loading image "+ioe);
}
//Set newly created canvas as current canvas
dgDisplay.setCurrent(hdCanvas);
}

public void pauseApp()
{
}

public void destroyApp(boolean unconditional)
{
hdCanvas.stop();
}
public void commandAction(Command c, Displayable s)
{
if (c.getCommandType( ) == Command.EXIT)
{
destroyApp(true);
notifyDestroyed( );
}
}

public void HardDriveCanvasGameOver(long time, int score)
{
hdCanvas.stop();
try
{
goCanvas = new GameOverCanvas(this, time, score);
goCanvas.start();

//Command quitCommand = new Command("Quit", Command.EXIT, 1);
goCanvas.addCommand(ExitCommand);
goCanvas.setCommandListener(this);

}
catch (Exception exp)
{
System.err.println("Problem loading image "+exp);
}

dgDisplay.setCurrent(goCanvas);
}

} //end of class HardDriveMIDlet


its a simple mobile game..

heres the compiler error log:


F:\j2sdk1.4.2_07\bin>javac -classpath C:\WTK20\lib\midpapi\ -nowarn -d release H
ardDriveGame\src\HardDriveMIDlet.java
HardDriveGame\src\HardDriveMIDlet.java:13: cannot resolve symbol
symbol : class HardDriveCanvas
location: class HardDriveMIDlet
private HardDriveCanvas hdCanvas;
^
HardDriveGame\src\HardDriveMIDlet.java:14: cannot resolve symbol
symbol : class GameOverCanvas
location: class HardDriveMIDlet
private GameOverCanvas goCanvas;
^
HardDriveGame\src\HardDriveMIDlet.java:26: cannot resolve symbol
symbol : class HardDriveCanvas
location: class HardDriveMIDlet
hdCanvas = new HardDriveCanvas(this, "/car.png", "/obsta
cle.png");
^
HardDriveGame\src\HardDriveMIDlet.java:61: cannot resolve symbol
symbol : class GameOverCanvas
location: class HardDriveMIDlet
goCanvas = new GameOverCanvas(this, time, score);
^
4 errors


please help me
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. put your classes in a package - using the default package creates all sorts of confusing errors because Java makes assumptions about where to find the classes.
2. change your posting name - we do not appreciate dealing with obvious fake names
Bill
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1. put your classes in a package



Sorry, but I have to disagree with this. In J2ME it is a best practice not to create packages. This is because of the little extra bytes that it uses up, that on a J2ME device might be a precious commodity.

Actually, what I see is that those classes aren't written yet. I know it owuld be a lot of code, but are those Canvasas in their own package? If so, remove the package line form those classes.

Mark
 
Charlie Brown
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i changed my name

umm.. i have the code, and the classpath is the content of midpapi.zip in WTK20\lib, what else do i need?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic