簡體   English   中英

無法讀取環境變量

[英]Failed to read environment variable

我正在安裝用於Java的eclipse插件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公司)amd64呈現引擎:DirectX java.lang.RuntimeException:無法找到運行時安裝。 在以下位置搜索:F:\\ coba2無法讀取環境變量ARCGISRUNTIMESDKJAVA_10_2_4
com.esri.runtime.ArcGISRuntime.getInstallDirectory(未知源)
com.esri.runtime.ArcGISRuntime.a(未知來源)
com.esri.runtime.ArcGISRuntime.getClientLibPath(未知來源)

當您的應用程序找不到ArcGIS Runtime部署時,就會發生這種情況。

如果您在安裝了Java的ArcGIS Runtime SDK的計算機上運行,​​請將環境變量ARCGISRUNTIMESDKJAVA_10_2_4的值設置為ARCGISRUNTIMESDKJAVA_10_2_4所在的目錄。 默認值是C:\\Program Files (x86)\\ArcGIS SDKs\\java10.2.4 ,盡管SDK安裝程序應該為您設置了此環境變量。

如果您在未安裝用於Java的ArcGIS Runtime SDK的計算機上運行,​​請創建運行時部署並將其放置在應用程序的工作目錄中(本例中為F:\\coba2 )。 這是將ArcGIS Runtime部署到最終用戶計算機的方式。

另外,您可以使用ArcGISRuntime.setInstallDirectory(String)編程方式設置包含ArcGIS Runtime部署的目錄,但我不建議您這樣做,因為這樣您的應用程序將要求Runtime部署位於每台計算機上的同一目錄中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM