Create a simple map application

This topic describes how to create a basic map application using the project wizard in Eclipse. Before using this topic you must have installed ArcGIS Runtime SDK for Java on your Windows or Linux machine and installed the Eclipse plug-in.

Create a new project

  1. Start Eclipse.
  2. From the Eclipse menus choose File > New > Project.
  3. Expand the 'ArcGIS Runtime for Java' folder.
  4. Select the 'ArcGIS Runtime Java Map Application' as shown below. Click Next.

    New Project wizard screenshot

  5. Add a 'Project name' and optionally, set a custom project location. Click Next.

    New Java Project screenshot

  6. Click Next in the 'Java Settings' dialog.

    Java Settings dialog screenshot

  7. Add a Java Class Name of your choice then click Finish.

    Java Class dialog screenshot

  8. A new Java project is created containing the ArcGIS Runtime Java Dependent jars used by the API.
  9. Optionally, add the toolkit jar to your project by right-clicking on the project, selecting ArcGIS Tools > Add toolkit jar. The toolkit jar will then appear in your project under Referenced Libraries. You can now not only use any methods contained in this jar, but also browse the full source code contained in it. Expand the jar and double-click on any class file to view the class' source code.

Run the application

  1. Right-click the .java class (for example NewClass.java) in the Package Explorer and select Run As > Java Application.
  2. A map application will be created similar to the image below.

    Map application screenshot

  3. In Windows, by default the map application is rendered using DirectX; in Linux, the map is rendered using OpenGL. In Windows, if the map application is not created and the following console message appears, ensure you have installed DirectX according to the system requirements.
    DirectX Error: This may be caused by missing DirectX End-User Runtime installation.
  4. Alternatively, in Windows you can render your application using OpenGL by either:
    • inserting the following line of code before the JMap is constructed and before any Runtime components are initialized (such as locators):
      ArcGISRuntime.setRenderEngine(RenderEngine.OpenGL);

    • or using the following argument to the JVM:
      -Dcom.esri.runtime.renderEngine=opengl
    If no map is displayed, ensure you have installed OpenGL according to the system requirements.