In this guide, you will learn how to
Create a new project
- Click File>New and choose Project.

- Choose Java Project. Click Next.

- Enter ArcGIS_Engine as the project name. Leave the other options as their default values. Click Finish.

The ArcGIS_Engine project in the project appears in the Package Explorer.

Create the Engine library
Before building the application, you must set up the libraries it will be accessing. You will create a new library containing the ArcGIS Engine JAR files needed to get started.
- Right-click ArcGIS_Engine and choose Properties.

- In the left-hand panel, chose the Java Build
Path category. In the right-hand panel, click the Libraries tab and click Add Library.

- Choose ArcGIS Engine Library and click Next.

- The arcobjects.jar is displayed as below. Click Finish to create the library.

- It should now be added to the list of libraries. Click OK to add it to the project.

Build the ArcGIS Engine application
- First, you need to create a new visual class that will be the basis for the application. Right-click the ArcGIS_Engine project and choose New>Visual Class.

If you do not see Visual Class in the list, choose the Other option at the bottom. From there you can navigate to the Java>Visual Class and click Next.
- You need to set the properties of the new visual class. The source folder should already be ArcGIS_Engine. Change the name to EngineApp, then scroll down to Frame in the Style chooser on the bottom left. This will provide a base framework for the application. Finally, check the box to create a public static void main method. Click Finish.
You will use the default package for this simple application, but larger applications should create new packages.

The Eclipse interface appears similar to the following image. If it is the first time you have created a visual class, it may take a while for the Visual Editor to set up.

- You should now adjust the size of the design frame by minimizing the code display. Click the small arrow pointing down to maximize the pane size.

- Activate the JFrame by clicking this-"JFrame" from the Java Beans panel on the bottom left.

- Drag the corner of the JFrame to increase the size of the display.

- Click the Palette to the left of the design frame to open the different visual Beans. Click the ArcGIS Components folder to expand its contents.

- Click TOCBean and click the portion of the frame entitled West. The content pane will automatically space it to the left side.

- On the Name dialog box that appears, name the Bean TOC. Click OK.

- Click MapBean from the palette and click the center
portion of the frame. Name it Map and click OK.
- Click ToolbarBean from the palette and click on the North section. Name it ToolBar. The frame appears as follows:

- You have now finished building the framework for the simple application. Next, the properties of the visual Beans must be set so that they properly interact with each other. Click the ESRI TOCControl to make it active. In the Property list at the bottom, select the BuddyControl property and click the small arrow button. A list of appropriate values is displayed. Map, the value you entered for the MapBean in the application appears, select Map to set the property.

- The ToolBarBean needs the same property set. Activate the ESRI ToolBarControl and set its BuddyControl property to Map as well.
All the components are now ready to interact with each other. The next step is to add data to the map and tools to the toolbar.
- Right-click the ESRI MapControl and choose Customize Java Bean.

- Here you can set various properties for the map. At this point, you simply want to choose a map document to be displayed. Click the open folder button and find a *.mxd file (ArcGIS/java/samples/data/mxds/usa.mxd). Click OK to close the dialog box.

- Right-click the ESRI ToolBarControl and open its
Customize Java Bean dialog box.
- Click the Items tab and click Add.
- You can select different types of commands to be included on the toolbar. Navigate to the Map Navigation category.

- You can double-click individual commands or a category to add them to the toolbar. You can also highlight a command and click the Add Command button to add it separately. For now, choose several items and add them. Click Close. All the items are listed in the Java Property Editor. You can also remove individual items from this list.

- To remove an item, right-click it and choose Delete. This dialog box also allows you to begin a Toolbar group or show text instead of the icon on the toolbar. Leave the Image Only option selected to show the icons.

- When finished setting up the toolbar, click OK.
Complete the code and initialize the Engine license
You are almost ready to run your application. However, you must first set an appropriate runtime license and make a few other additions to the code.
- Expand the code view to take up more of the Eclipse interface. In several places, some red underlined code is visible with a small red x on the left panel. Eclipse is showing that this item needs attention, and it can easily be resolved by clicking the red x.

- A dialog box will pop up with options on how to fix the code. This situation can be easily resolved by clicking the Surround with try/catch option and the code will automatically be inserted.

This should be done for the Table of Contents (TOC), Toolbar, and map components where the red x appears. Alternatively, you can set the preferences of the visual editor to always create the try/catch block. Click Window > Preferences and choose Java/Visual Editor. Click the Code Generation tab and check the Generate try{}catch() block option. The try/catch block will be automatically added every time.

- The Engine application needs to be properly licensed. A shortcut is available to create this code. Right-click in the code editor and choose ArcGIS>Insert License Code.

- Check the box for ArcGIS Engine product license and click OK.

This code creates a new method to initialize the ArcGIS license check and checks for the Engine product code. Refer to Licensing and deployments for more information regarding licensing and the various uses of it.
- After creating the license method, you must also call it within the main method of the application before it starts. Just below the line initialize(); in the default constructor, add this line:
initializeArcGISLicenses();
- You must also initialize the visual Beans in the main method. In the public static void main method, enter this line:
com.esri.arcgis.system.EngineInitializer.initializeVisualBeans();
- You need to create a new instance of the application and make it visible before running it. Enter these lines in the main method as well:
EngineApp map = new EngineApp();
map.setVisible(true);
- Save your project.
- Right-click EngineApp.java from the Package Explorer and choose Run As>Java Application.

- The application window appears with the toolbar and map items you specified.
