我正在安装eclipse插件,用于java的ArcGis Runtime SDK,但是当我创建一个简单的地图应用程序然后我运行它时,它是不对的
我的代码:
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.JMap;
import com.esri.map.MapOptions;
import com.esri.map.MapOptions.MapType;
public class coba2class {
private JFrame window;
private JMap map;
public coba2class() {
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();
}
});
// Before this application is deployed you must register the application on
// http://developers.arcgis.com and set the Client ID in the application as shown
// below. This will license your application to use Basic level functionality.
//
// If you need to license your application for Standard level functionality, please
// refer to the documentation on http://developers.arcgis.com
//
//ArcGISRuntime.setClientID("your Client ID");
// Using MapOptions allows for a common online basemap to be chosen
MapOptions mapOptions = new MapOptions(MapType.TOPO);
map = new JMap(mapOptions);
// If you don't use MapOptions, use the empty JMap constructor and add a tiled layer
//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 {
coba2class application = new coba2class();
application.window.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} }
在我运行之后,我收到了这个警告。
Java版本:1.8.0_25(Oracle Corporation)amd64渲染引擎: DirectX java.lang.RuntimeException:无法找到运行时 安装。搜索以下地点:F:\ coba2无法阅读 环境变量ARCGISRUNTIMESDKJAVA_10_2_4
com.esri.runtime.ArcGISRuntime.getInstallDirectory(Unknown Source)
com.esri.runtime.ArcGISRuntime.a(未知来源)
com.esri.runtime.ArcGISRuntime.getClientLibPath(未知来源)
答案 0 :(得分:1)
当您的应用无法找到ArcGIS Runtime部署时,会发生这种情况。
如果您在安装了ArcGIS Runtime SDK for Java的计算机上运行,请将环境变量ARCGISRUNTIMESDKJAVA_10_2_4
的值设置为arcgisruntime10.2.4所在的目录。默认值为C:\Program Files (x86)\ArcGIS SDKs\java10.2.4
,但SDK安装程序应为您设置此环境变量。
如果您在没有安装ArcGIS Runtime SDK for Java的计算机上运行create a Runtime deployment并将其放在应用程序的工作目录中(F:\coba2
)。这是将ArcGIS Runtime部署到最终用户计算机的方法。
或者,您可以使用ArcGISRuntime.setInstallDirectory(String)
以编程方式设置包含ArcGIS Runtime部署的目录,但我不推荐它,因为您的应用程序将要求运行时部署位于每个的同一目录中机。