ArcGIS Runtime SDK for Java

Develop your first map app with Gradle

Use the steps below to create a basic mapping app using the Gradle build tool. The steps use the Eclipse IDE, but other IDEs have Gradle support too.

Make sure your development machine meets the System requirements for 100.4.0.

Create a Gradle project in Eclipse

  1. In Eclipse, click File > New > Project in the menu bar. In the New Project dialog, select the Gradle folder and click Gradle Project. Click Next.

    Eclipse new project wizard dialog with Gradle Project selected
  2. In the Project name field, enter app and click Finish.

    In the Package Explorer, your new project structure should appear as follows:

    Package explorer with default gradle project structure
  3. Remove the automatically generated files. Delete the file in src/main/java and the file in src/test/java.

Add SDK dependencies to your buildscript

  1. In the Package Explorer, double-click the build.gradle file. Replace the contents with the following:

    apply plugin: 'eclipse'
    apply plugin: 'application'
    //apply the ArcGIS Java SDK Plug-in for Gradle
    apply plugin: ''
     buildscript {
      repositories { maven { url '' } }
      dependencies { classpath 'com.esri.arcgisruntime:gradle-arcgis-java-plugin:1.0.0' }
     arcgis.version = '100.4.0'
     // download javadoc
    eclipse.classpath.downloadJavadoc = true

  2. Save the file. In the Package Explorer, right-click the app project and select Gradle > Refresh Gradle Project to apply the changes to the buildscript.

    The ArcGIS Java SDK Plug-in for Gradle will download the SDK's native libraries to the user's home directory.


    It may take a minute to download the native libraries depending on your network speed, but this will only happen the first time you use the SDK.

Develop a JavaFX map app

  1. Under the project's src/main/java source directory, create the package structure In the app package, create a new class called MyMapApp.

    Package explorer showing class MyMapApp in package
  2. Double-click the class file in the Package Explorer and replace the code with the following JavaFX application:

    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class MyMapApp extends Application {
      public void start(Stage stage) throws Exception {
        // create stack pane and application scene
        StackPane stackPane = new StackPane();
        Scene scene = new Scene(stackPane);
        // set title, size, and add scene to stage
        stage.setTitle("Display Map Sample");
      public static void main(String[] args) {

  3. Right-click the code in the editor and choose Run As > Java Application. The app will open to show a empty window with titled "Display Map Sample".
  4. Following imports are for adding a basemap to a map and displaying that map to the map view.

    import com.esri.arcgisruntime.mapping.ArcGISMap;
    import com.esri.arcgisruntime.mapping.Basemap;
    import com.esri.arcgisruntime.mapping.view.MapView;

  5. After the class definition, a private variable for map view is added so it can be disposed of when application is finished.

    public class MyMapApp extends Application {
      private MapView mapView;

  6. In the start function, after the line the following tasks:
    1. Creates an ArcGISMap class, which defines the content of the map.
    2. Adds a basemap to the ArcGISMap class showing Imagery mapping.
    3. Creates a MapView JavaFX visual component that's linked to the Map class.
    4. Adds MapView to JavaFX application using the StackPane layout.

    // create a ArcGISMap with the a Basemap instance with an Imagery base layer
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());
    // set the map to be displayed in this view
    mapView = new MapView();
    // add the map view to stack pane

  7. Overrides the stop method to dispose of application resources when the app closes.

     * Stops and releases all resources used in application.
    public void stop() {
      if (mapView != null) {

  8. Example of what the map should look like. You can use the mouse to zoom and pan the map.