File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "cannot resolve symbol" Watch "cannot resolve symbol" New topic
Author

cannot resolve symbol

Charlie Brown
Greenhorn

Joined: Jun 27, 2005
Posts: 2
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Charlie Brown
Greenhorn

Joined: Jun 27, 2005
Posts: 2
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot resolve symbol