com.esri.runtime.ArcGISRuntime

499
4
02-13-2017 08:14 AM
ArturGrzesiuk
New Contributor

Hello,

first of all, i am working with Eclipse Neon2 (4.6.2)

-jre1.8.0_121

-jdk1.8.0_121

since two weeks it is not possible to run the Application, because it`s immediately terminating. Eclipse shows, that the import "com.esri.runtime.ArcGISRuntime" is never used. I really don`t know what happened. I hope you can help me.

0 Kudos
4 Replies
nita14
by
Occasional Contributor III

Hi Artur,

What version of Runtime do you use? 100.0.0? Do you initialize MapView or JMap (10.2.4)? Can you post your code?

Regards,

Adam

0 Kudos
ArturGrzesiuk
New Contributor

It is the version 10.2.4.

package Jeden;

import java.awt.EventQueue;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.esri.runtime.ArcGISRuntime;
import com.esri.map.ArcGISTiledMapServiceLayer;
import com.esri.map.JMap;

public class Aplikacja {

  private JFrame window;
  private JMap map;

  public Aplikacja() {
    window = new JFrame();
    window.setSize(800, 600);
    window.setLocationRelativeTo(null); // center on screen
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.getContentPane().setLayout(new BorderLayout(0, 0));

    // dispose map just before application window is closed.
    window.addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent windowEvent) {
        super.windowClosing(windowEvent);
        map.dispose();
      }
    });

    JMap map = new JMap();
    
    ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(
      "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
    map.getLayers().add(tiledLayer);

    // Add the JMap to the JFrame's content pane
    window.getContentPane().add(map);

  }

  /**
   * Starting point of this application.
   * @param args
   */
  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {

      @Override
      public void run() {
        try {
          Aplikacja application = new Aplikacja();
          application.window.setVisible(true);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    });
  }
}

0 Kudos
nita14
by
Occasional Contributor III

Hi,

Have you installed Eclipse Plugin? Install the Eclipse plug-in—ArcGIS Runtime SDK for Java | ArcGIS for Developers    

You should be able to run the application. You just may want to remove ArcGISRuntime import since it has not been used. Also initialize JMap as an instance variable, that is: map = new JMap();, in order to being able to close the app.

Also make sure that you can create ArcGIS Runtime Java Map Application (File > New > Project > ArcGIS Runtime Java Map Application). 

Hope this helps,

Adam

0 Kudos
ArturGrzesiuk
New Contributor

Hi,

i really don`t know what happened, but after the update of the graphics drivers it works. The code i`ve posted is the original code created by "File > New > Project > ArcGIS Runtime Java Map Application". Thank you very much for your help. Maybe i should have tried to choose an other renderer (OpenGL), but there wasn`t even a DirectX error. Thank you very much for your help

Pozdrawiam

Artur

0 Kudos