2 Replies - 11499 Views - Last Post: 24 April 2012 - 02:45 AM Rate Topic: -----

#1 futureEngineer23  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-April 12

Error in grid world cannot find package info.gridworld.

Posted 16 April 2012 - 07:00 PM

import info.gridworld.actor.Actor;
import info.gridworld.grid.Location;
import info.gridworld.grid.BoundedGrid;
import info.gridworld.actor.ActorWorld;
import java.util.ArrayList;
import java.awt.Color;

public class ActorListOne
{
	public static void main(String[] args)
	{
		ActorWorld world = new ActorWorld(new BoundedGrid<Actor>(5,5));
		
		ArrayList<Actor> actList = new ArrayList<Actor>();
		
		//add in least three actor references to actList
		actList.add(new Actor());
		actList.add(new Actor());
		actList.add(new Actor());

		//set each actor to a different color (GREEN, YELLOW, RED)	
		actList.get(0).setColor(Color.GREEN);
		actList.get(1).setColor(Color.YELLOW);
		actList.get(2).setColor(Color.RED);
					
		//use a loop to add all actor references to the world at different locations
		for (int i = 0; i<actList.size; i++)
		{
			world.add(new Location(i,i), actList.get(i));
		}
		
		world.show();
	}
}



I am given an error saying:
cannot find symbol class Actor line 18
cannot find symbol class Actor line 20
cannot find symbol class Actor line 20
cannot find symbol class Actor line 23
cannot find symbol class Actor line 24
cannot find symbol class Actor line 25
cannot find symbol class ActorWorld line 18
cannot find symbol class ActorWorld line 18
cannot find symbol class BoundedGrid line 18
cannot find symbol class Location line 35
package info.gridworld.actor does not exist line 7
package info.gridworld.actor does not exist line 10
package info.gridworld.grid does not exist line 8
package info.gridworld.grid does not exist line 9

Is this in my code ( and if it is can someone please give me a direction to go in to correct this) or is this due to the fact I am having some problems opening the JCP file?
Any help would be greatly appreciated Thank You!

Is This A Good Question/Topic? 0
  • +

Replies To: Error in grid world cannot find package info.gridworld.

#2 Swillis57  Icon User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 31
  • Joined: 14-January 11

Re: Error in grid world cannot find package info.gridworld.

Posted 16 April 2012 - 10:14 PM

It's nothing in your code, those errors are caused by Java not being able to find the GridWorld.jar file. If you're using an IDE (such as Netbeans or Eclipse), there should be a specific folder you can copy the .jar file into in the project.
Was This Post Helpful? 0
  • +
  • -

#3 jdavi134  Icon User is offline

  • D.I.C Head

Reputation: 42
  • View blog
  • Posts: 225
  • Joined: 26-October 11

Re: Error in grid world cannot find package info.gridworld.

Posted 24 April 2012 - 02:45 AM

As Swillis has said, you need to add an external jar file to your project. This is a fairly simple task.

The instructions for adding the JAR file can be found here.
Instructions

And the Website GridWorld Resources Post can be found here:
Resources

Happy Coding

Jack
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1